Liquid Layout? (Resize event?)

Questions regarding AIR and Flex.

Liquid Layout? (Resize event?)

Postby troynb » Fri Jan 16, 2009 11:58 pm

Hi,

I'm currently pretty new to Flex 3.0, and I'm trying to create a Flex application that has a layout out the moves when the the browser is resized. I've seen a few tutorials on how to do this in Flash, but is it the same in Flex? Basically I know that I am supposed to determine when the browser is resized, then I adjust the x and y positions of the elements on my page based on the current size of the Flex stage.

What event listener do I use to determine when the browser is moved/resized and how do I bind that to objects (for example a swf or image that I imported)?


I've searched google and looked at the Adobe livedocs and can't seem to find any examples that explain what I need to do. Any suggestions are appreciated :)
troynb
 
Posts: 58
Joined: Mon Mar 13, 2006 2:50 pm
Location: Florida

Re: Liquid Layout? (Resize event?)

Postby iBrent » Sat Jan 17, 2009 12:15 am

Hi,

Well, you're in luck because in Flex, it's all done automatically for you, as long as you use constraint based layouts. It is 1000 times easier to do this in Flex than in Flash. You can listen for a resize event from the stage, but that's unnecessary.

Look at the docs here for what I mean --> http://livedocs.adobe.com/flex/3/html/h ... ion_5.html

It's so much better in Flex.

:D

iBrent
_________________________

Ask iBrent

Image

Image
User avatar
iBrent
Site Admin
 
Posts: 1004
Joined: Mon Mar 13, 2006 4:37 pm
Location: Utah, USA
Flash Version: Adobe Flash CS5.5
Authoring Environment: Apple OS

Re: Liquid Layout? (Resize event?)

Postby Barna Biro » Fri Jan 30, 2009 11:57 pm

You simply need to set the width and height properties as a percentage instead of static size, ex: width="90%" this way the specified component will always "eat up" 90% of the container's space it is in ( be it the main Application or maybe a HBox, VBox and so on ).
Image
User avatar
Barna Biro
 
Posts: 58
Joined: Mon Oct 20, 2008 11:14 am
Location: Luzern, Switzerland
Flash Version: Other Flash version
Authoring Environment: Apple OS

Re: Liquid Layout? (Resize event?)

Postby troynb » Sun Feb 01, 2009 1:17 am

Thanks for the suggestions. My problem is that I am working on something in Flex that looks like a flow chart. I have a "legend' that I created in Flash that shows what each shape of the flow chart means. When I click on this legend, I use MXML to make it move from the upper right corner, and it shrinks to about 10% of it's original size and docks into the lower left corner. I can't really set it to 90% because the size of the swf changes, and also the the location of the swf changes. That's why I was wondering if there is some time of resize event that I can use. So far I haven't had any luck.
troynb
 
Posts: 58
Joined: Mon Mar 13, 2006 2:50 pm
Location: Florida

Re: Liquid Layout? (Resize event?)

Postby Barna Biro » Mon Feb 02, 2009 2:58 am

Flex isn't really for animation and it's not easy to pull of stuff like this... I'm not really sure myself if there's an easy solution for this... Theoretically "everything is possible, the impossible just takes longer".
Image
User avatar
Barna Biro
 
Posts: 58
Joined: Mon Oct 20, 2008 11:14 am
Location: Luzern, Switzerland
Flash Version: Other Flash version
Authoring Environment: Apple OS


Return to AIR and Flex

Who is online

Users browsing this forum: Bing [Bot] and 2 guests