Gaia 6: Liquid Layout

Liquid Layout

One thing that will make your flash sites look like those of the big boys is having a liquid layout. Objects automatically reposition themselves when the browser is resized.

Here are a few sites that use liquid layout:
pixelControl.org
http://www.jeanmalek.com/
http://www.factorylabs.com/

 

Tags: , , , ,

61 Responses to “Gaia 6: Liquid Layout”

  1. samBrown
    February 25, 2011 at 7:49 pm #

    little bit GS, little bit Gaia, all awesome. Nice tutorial – keep it up!

    • Thon Lorenz
      February 28, 2011 at 10:15 pm #

      Thanks samBrown. I wasn’t sure if people would find the topic of liquid layout relevant so I’m glad to hear that you’ve found it interesting. Thanks for visiting.

  2. rp
    February 28, 2011 at 3:12 pm #

    Awesome! Thanks for your time one this!!

    • Thon Lorenz
      February 28, 2011 at 10:07 pm #

      Thank rp. I took a peak at your site, cool work. Very fun, great animations and artwork.

  3. Peter
    March 1, 2011 at 1:41 am #

    The only problem with liquid stage is that you must pay for it, and right now there’s no way how to test it ;)

    • Peter
      July 24, 2011 at 3:39 pm #

      Hi same name guy ;)

      GS is worth every penny, actually since I am full member I got the 150dollar back in terms of speed in just 1 job. It’s amazing how well combined the whole package is, loadermax, tween, layout,etc
      Honestly I couldn’t see myself developing without the GS package. Heck I even forgot how I pulled it all off before that. :D

      you can perfectly test the layout module here: http://www.greensock.com/liquidstage/

      hope that helps.

  4. JP
    March 3, 2011 at 7:05 pm #

    Thanks for all you great tutorials Thon!. I have a question, how can i attach an Array of buttons for example i know that using :

    ls.attach(button, ls.TOP_LEFT);

    but if i have for example:

    navArray = [boton1,boton2,boton3,boton4,boton5];

    the code have to be? :

    ls.attach(navArray, ls.TOP_LEFT);

    • Thon Lorenz
      March 3, 2011 at 7:14 pm #

      Close, lets take a look at the arguments for the attach() method of the LiquidStage Class

      attach(target:DisplayObject, pin:PinPoint, strict:Boolean = false, reconcile:Boolean = true, tweenDuration:Number = 0, tweenVars:Object = null, roundPosition:Boolean = false):void

      Only the first two arguments are mandatory and their the only ones we’re concerned about. We can see that the first argument, target, has a data type of DisplayObject. That means it can only take MovieClips, TextFields, etc. Unfortunately that doesn’t include arrays. But we can easily iterate (loop) over the array. We can do this with a for each loop.

      for each (var button:DisplayObject in navArray)
      {
      ls.attach(button, ls.TOP_LEFT);
      }

      Let me know how that works for you.

      ~thon

  5. JP
    March 3, 2011 at 9:08 pm #

    Tks now all works perfectly!!!

  6. Calvinalibra
    March 10, 2011 at 6:20 pm #

    Once again, another great tutorial. What do you think about creating a tutorial for custom preloaders??

  7. Dave
    April 24, 2011 at 10:06 pm #

    Thon, I’m having an issue with locating my items when using liquid stage and greensock when I am tweening to the right or left (tweening up/down poses no issue). When I re-size my browser the items stay grouped but are not where they should be. Is there a trick to determine where the items should be? since my items are fixed sizes I would have thought that I could just say “TweenMax.to(title_mc, 1, {x:stage.width/2-200});” and end up 200 pixels left of center but I’m not comprehending what happened.

    thanks

    • Thon Lorenz
      April 25, 2011 at 7:58 am #

      Hi Dave,
      Try to use the property stage.stageWidth for getting the current width of the stage. Let me know if that works for you.

      • Dave
        April 26, 2011 at 3:47 am #

        Yes that worked great!! Thanks

  8. Mickey
    May 25, 2011 at 6:40 am #

    great tutorial, thanks again, i have been trying to make my page full screen just by altering the values in the publish settings and the html params attributes, but now i am getting a blank screen, is their any way that i can have a full screen webpage using gaia without purhasing extra frameworks, i have posted on this gaia forum, but still no luck, i would really appreciete it if u could have a look

    http://www.gaiaflashframework.com/index.php/topic,4132.0.html

    • Thon Lorenz
      May 25, 2011 at 10:35 am #

      Hey Mickey,

      I’m not sure why you’d be getting nothing but black in full screen mode. Going to full screen is the easy part. Having the site expand and contract properly is something that I always had difficulty with. It was a problem I never found a good solution for. Although liquid layout from greensock costs money I found that it was extremely cost effective since I couldn’t find a fix on my own.

      Good luck,

  9. Mickey
    May 26, 2011 at 3:42 pm #

    do i have your permission to post the link of this page in the topic i posted in the gaia forum, concerning full screen flash pages?

    • Thon Lorenz
      May 26, 2011 at 4:02 pm #

      by all means

  10. Wiyono
    June 24, 2011 at 12:09 pm #

    I can’t buy Greensock, Is there any other alternativ? only make the content fullbrowser and center page?

    I try to edit on “Main.as” (gaia) but going not good…….

    Please help me?

    • Thon Lorenz
      June 24, 2011 at 12:14 pm #

      You don’t need greensock to make the content fullbrowser and center the page. In the Gaia panel click the project tab. Look where you set the width and heigh of your project. Check the 4 boxes that say:
      Width 100%, Center X, Hight 100%, Center Y

  11. Mickey
    July 20, 2011 at 6:15 pm #

    Hey Thon

    What size did u set the stage for pixelcontrol.com, i ask because it looks really cool on both 13″ and 21″ monitor, i want people to feel the same way when visting a site of my own.

    Thanks in advance

    • Thon Lorenz
      July 20, 2011 at 6:41 pm #

      Hi Mickey,

      While the site has a liquid layout the size it was designed at 960px by 600px (that’s also its smallest possible size the site can shrink to)

      Best,

  12. Niek
    July 29, 2011 at 3:44 pm #

    Thon,

    Nice tutorials, keep up the good work. Im playing a bit with liquidarea and liquidstage atm, but i was wondering something. Is it also possible to stretch a line filled with dots that keep the same width, but a variable height? or same height variable width? I got this worked out with a solid line, but i dont know how to do this with a dotted line.

    Again thx for the tutorials:)

    • Thon Lorenz
      July 29, 2011 at 4:30 pm #

      Hi Niek,
      Thanks for viewing. Two answer your questions, yes, just scaling the with or height should be doable. If you don’t want the dots to distort you could make a really long line of dots and just have a mask adjust its sized based on the stage. That way you’s just reveal more dots as the line got longer.

      Hope that helped,
      Thon

  13. Niek
    July 29, 2011 at 5:00 pm #

    Thanks for your help Thon. I went for the second option, the really long line. Its around 7000px now. I dont think anybody is going to see the end of that line :P

    • Thon Lorenz
      July 29, 2011 at 5:19 pm #

      Nice :)

  14. HappyEverline
    August 4, 2011 at 10:41 am #

    Thon Lorenz;
    Awesome tuts m8 verry cool and enlightning.

    Heey man could you pleas make your videos donwloadeble again?

    I’d tryed some external downloaders but they seem to download only 70 percent of the actual video.

    However I did like the fuction you had in you previous videos where as you were able to download the content.
    This way i can keep then as refference on my HD.

    ?So please ad the download link on top of the stream button of vimeo again! Thc m8 :)

    • Thon Lorenz
      August 4, 2011 at 5:51 pm #

      Hi happyEverline,

      Glad you like the movies. You can download all of the videos from Vimeo. You’ll need a Vimeo account which is free.
      Thanks,
      Thon

  15. Niek
    August 10, 2011 at 7:56 am #

    Hey thon,

    Your tutorials are really nice, but can u maybe make a tutorial about LoaderMax? implemented in Gaia Frameworks:D

    thx

  16. Thon Lorenz
    August 12, 2011 at 7:34 pm #

    Hi Niek,

    Thanks for the kind words and your viewership. I don’t use LoaderMax, I always use Gaia’s loading ability to load assets. So we won’t be creating a video on LoaderMax but I’ll try to make a video on using Gaia’s loader to load assets in the next week or two.

    Best,
    Thon

  17. Rex
    August 25, 2011 at 4:57 am #

    Hi Lorenz,

    Thanks for your great lesson, it really helps a lot. But I am still having a bit problem aligning GAIA Assets and need your suggestion.

    Here’s my situation in GAIA, I want to add a simple SWF in index.swf and using LiquidStage to align it to the bottom left.

    1.Adding asset in site.xml:

    2.Then in IndexPage.as, adding the code below,

    override public function transitionIn():void
    {
    super.transitionIn();
    assets.footer.visible = true;
    //Stage Align
    var ls:LiquidStage = new LiquidStage(this.stage, 960, 600, 960, 600);
    ls.attach(assets.footer, ls.BOTTOM_LEFT);
    TweenMax.to(this, 0.3, {alpha:1, onComplete:transitionInComplete});
    }
    3. some compilling problems tells:
    T:\Test\src\com\pages\IndexPage.as, Line 53 1067: Implicit coercion of a value of type com.gaiaframework.api:IDisplayObject to an unrelated type flash.display:DisplayObject.

    some suggestion needed, thank you! and waiting for your new GAIA asset lessons release!

    • Thon Lorenz
      August 25, 2011 at 10:29 am #

      Hi Rex,

      You could try a few things. I would have assumed an IDisplayObject extends the DisplayObject class. So try “casting” footer asset as a DisplayObject. Casting is where you tell the complier its wrong and the object is indeed the class its suppose to be.

      ls.attach(DisplayObject(assets.footer), ls.BOTTOM_LEFT);

      If that doesn’t work there is one more thing to try.

      ls.attach(assets.footer.container, ls.BOTTOM_LEFT);

      Gaia assets are a little odd in that they have a property “container” which represents a displayObject that wraps the asset. (http://www.gaiaflashframework.com/wiki/index.php?title=Assets#container)

      Hope that helps

      • Rex
        August 25, 2011 at 9:11 pm #

        Thanks Lorenz, it works great!
        “ls.attach(assets.footer.container, ls.BOTTOM_LEFT);” is the answer. GAIA do have its own container rule and it’s a great concept you gave! Thanks!

        • Thon Lorenz
          August 26, 2011 at 1:17 pm #

          Glad to hear it worked!

  18. Niek
    September 1, 2011 at 1:42 am #

    Hi Thon,

    I created a website with Gaia and liquidstage/layout, but for some reason, my website only works properly with google chrome. When you open it with IE or firefox, u only see the top part of it. And the strangest thing is, it does work with IE6:S I dont know what the problem is to be honest.

    Any suggestions?

    (p.s. when does the next tutorial comes out? :P )

    • Thon Lorenz
      September 1, 2011 at 8:16 am #

      Do you have your site posted some place so I could take a look? Also, I know we’ve been dragging on the next video. We just started a business this year and its been a lot of work (that’s a good thing). I’ll try to get on the ball again during september. Thanks for reminding me :)

  19. Niek
    September 1, 2011 at 12:40 pm #

    Hi,

    i got a temp site up at http://www.niekvanderputten.nl , and a test version on http://www.niekvanderputten.nl/test . The final version isnt done yet. but these 2 also have the problem.

    thx

  20. Niek
    September 7, 2011 at 5:39 am #

    Ok weird… for some reason only google chrome shows this message that i sended a week ago.. As u can see in the lost message, i have a temp version at http://www.niekvanderputten.nl, and a test version at http://www.niekvanderputten.nl/test. Both have the same problem.

    Thx

    Niek September 1, 2011 at 12:40 pm #
    Hi,

    i got a temp site up at http://www.niekvanderputten.nl , and a test version on http://www.niekvanderputten.nl/test . The final version isnt done yet. but these 2 also have the problem.

    thx

    Your comment is awaiting moderation.

    • Thon Lorenz
      September 7, 2011 at 12:26 pm #

      Looks like there is some css coming from some place that’s setting the flash content div to visibility: hidden.

      Let me dig a litte more and get back to you. Is this Gaia’s default html?

      • Niek
        September 8, 2011 at 3:53 am #

        Yeah default gaia html, onlything i changed is the width and height, from pixels into 100%.

        • Thon Lorenz
          September 10, 2011 at 12:02 pm #

          Hey Niek, just wondering if you got my email. Did you get the site working?

          • Niek
            September 11, 2011 at 8:17 am #

            Unfortunately not. The JS file isnt the problem, cause it is on the server. Also, i tried to to override the current css with:

            #flashcontent {
            visibility: visible !important;
            }

            But it didnt helped either. Not really sure what the problem is though:( At First i thought i would have to do something with the css.

    • Thon Lorenz
      September 12, 2011 at 8:48 am #

      Looks like you got your sites working. Very nice

      • Niek
        September 12, 2011 at 9:51 am #

        Hey Thon,

        For some reason the sites still dont work with IE, only google chrome. Even when i overrided the CSS. I uploaded 2 screenshots. On this screenshot u see the result in IE32bits: http://www.niekvanderputten.nl/screenie.jpg

        On this screenshot u see the result in IE64bits and google chrome: http://www.niekvanderputten.nl/screenie1.jpg

        Really strange that the site worked on your computer:S But over here they still dont work

        Sorry to bother u with all those problems:P

        • Thon Lorenz
          September 12, 2011 at 9:57 am #

          Could be a cache issue. Are you sure you emptied the cache on those browsers? You’ll have to do that to see changes take place.

          • Niek
            September 12, 2011 at 10:11 am #

            Yep did it a couple of times in IE, also checked it on my dads computer. Same result.

        • Thon Lorenz
          September 12, 2011 at 11:59 am #

          I’m not sure what the problem could be. Sorry I can’t be more of a help. Not that good at CSS myself

  21. Niek
    September 7, 2011 at 2:25 pm #

    Yeah default html, only changed the height/widt from pixels to 100%.

  22. Zync
    September 16, 2011 at 6:53 pm #

    Awesome tutorial btw. Love your just. Just wondering how you’d go about aligning a whole page tho and not just an element? like suppose you want all your content to be in the center of the screen in GAIA but just a few elements on the edges and pinned with Liquid Stage?

    The center x and Y seems to move the pinned objects out of alignment unless I’m doing something majorly wrong.

    • Thon Lorenz
      September 19, 2011 at 8:41 am #

      Hi Zync, difficult to say from you description but I think you’re on the right track. Keep playing with the centering x and y, try to pin the objects to the center and see if you can figure out how to get your desired look.

      Best,

  23. Marcus Olley
    November 1, 2011 at 8:01 am #

    Hi Thon,

    I watched this Liquid Layout video and followed it intensely but i couldnt get it to work. I kept getting these errors:

    Liquid Layout\flash\source\com\LiquidLayout\pages\NavPage.as, Line 37 1136: Incorrect number of arguments. Expected 0.
    Liquid Layout\flash\source\com\LiquidLayout\pages\NavPage.as, Line 38 1061: Call to a possibly undefined method attach through a reference with static type com.greensock.layout:LiquidStage.
    Liquid Layout\flash\source\com\LiquidLayout\pages\NavPage.as, Line 38 1119: Access of possibly undefined property TOP_RIGHT through a reference with static type com.greensock.layout:LiquidStage.
    Liquid Layout\flash\source\com\LiquidLayout\pages\NavPage.as, Line 39 1061: Call to a possibly undefined method attach through a reference with static type com.greensock.layout:LiquidStage.
    Liquid Layout\flash\source\com\LiquidLayout\pages\NavPage.as, Line 39 1119: Access of possibly undefined property TOP_RIGHT through a reference with static type com.greensock.layout:LiquidStage.
    Liquid Layout\flash\source\com\LiquidLayout\pages\NavPage.as, Line 40 1061: Call to a possibly undefined method attach through a reference with static type com.greensock.layout:LiquidStage.
    Liquid Layout\flash\source\com\LiquidLayout\pages\NavPage.as, Line 40 1119: Access of possibly undefined property TOP_RIGHT through a reference with static type com.greensock.layout:LiquidStage.

    Please could you help me with this.

    Kind Regards

    Marcus

    • Thon Lorenz
      November 1, 2011 at 9:40 am #

      Hi Marcus,
      Its difficult to know for sure by looking at what you’ve provided but lets take a look. When ever you’re dealing with errors tackle the first one. All others may be caused by it.

      Line 37 1136: Incorrect number of arguments. Expected 0.

      Looks like you have a method that is receiving too many arguments. Double check your code on line 37 and make sure its correct. If you’re unfamiliar with arguments we have a video on functions you should checkout. That’s the best help I can be. I hope it clears things up.
      Thanks,
      Thon

      • Tommy
        December 11, 2011 at 3:22 am #

        I also got the same first three errors

        -1136: Incorrect number of arguments. Expected 0.
        -1061: Call to a possibly undefined method attach through a reference with static type com.greensock.layout:LiquidStage.
        -1119: Access of possibly undefined property BOTTOM_RIGHT through a reference with static type com.greensock.layout:LiquidStage.

        I really cant find a solution even with the video on arguments.
        Greatly appreciated

    • jp-interactivemedia
      December 17, 2011 at 12:58 am #

      Hi Marcus,

      I also encountered that problem and i found a solution for it. I open the liquidStage.as class on the greensock folder and check the function that has the arguments.

      instead of using:
      var ls:LiquidStage = new LiquidStage(this.stage, 800, 600, 800, 600);
      ls.attach(homeButton, ls.TOP_RIGHT);

      try to use:
      LiquidStage.init(this.stage, 960, 600, 800, 600);
      LiquidStage.pinObject(homeButton, LiquidStage.TOP_RIGHT);

      it worked for me and fixed the problem. Hope i can help.thanks

      • jp-interactivemedia
        December 17, 2011 at 2:40 am #

        Marcus,

        I think you are using the old version of greensock thats why you are having the errors. just what i mentioned on my previous reply. also on the previous version there is no liquidArea.as class. instead use :

        LiquidStage.init(this.stage, 550, 400, 550, 400);
        LiquidStage.stretchObject(myObject, LiquidStage.TOP_LEFT, LiquidStage.TOP_RIGHT, LiquidStage.BOTTOM_RIGHT);

        to achieve the liquidArea functionality..

        thanks

  24. niek
    November 9, 2011 at 10:41 am #

    Hey thon,

    when can we expect the new tutorial about loading assets with gaia. Last time u said it would be in september:P

    Thx

  25. Niek
    November 25, 2011 at 2:46 pm #

    Hey thon,

    when can we expect the new tutorial about loading assets with gaia. Last time u said it would be in september:P

    Thx Niek

  26. Tommy
    December 11, 2011 at 3:52 am #

    I corrected them but now i get these errors

    1084: Syntax error: expecting identifier before rightparen.

    1084: Syntax error: expecting rightparen before ls.

    please help! its driving me crazy!
    thanks.

    • Thon Lorenz
      December 12, 2011 at 8:24 am #

      Hi Tommy,
      You’ll have to post your code for us to be able to help with this.

  27. Tommy
    December 13, 2011 at 9:58 pm #

    I fixed all the errors. Im having an issue though, when i publish everything in GAIA and resize it, the nav works fine BUT when i open up up index.html in my browser the nav doesnt flow all the way to the bottom left corner where its pinned at… any ideas why?

    • Thon Lorenz
      December 14, 2011 at 8:03 am #

      Hi Tommy, difficult to say without seeing code but go to the gaia panel – project tab – under properties: Make sure the width 100% box is checked and the height 100% box is checked.

      Also make sure Center X and Center Y is NOT checked.

      After you make the changes make sure you click the “apply” button.

      Hope that helps.

  28. MJP
    February 2, 2012 at 12:11 am #

    Thon,

    You’re a godsend! Thank you for extremely easy to follow and understand tutorials on GAIA and Greensock. (especially with the understanding of Liquid Stage)

Leave a Reply

If you are human, count objects:
Enable this image please
I see:
- +
- +
- +
Ironclad CAPTCHA (Security Stronghold)