Search This Blog

2009-07-27

Flex Tutorials 2-Define absolute layout,VBox & HBox

Layout property in the Application tag specifies the layout mechanism used for this application. Applications can use "vertical", "horizontal", or "absolute" positioning. Vertical positioning lays out each child component vertically from the top of the application to the bottom in the specified order. Horizontal positioning lays out each child component horizontally from the left of the application to the right in the specified order. Absolute positioning does no automatic layout and requires you to explicitly define the location of each child component.
The default value is "vertical".
The HBox container lays out its children in a single horizontal row.
The VBox container lays out its children in a single vertical column.

Test the following code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Label text="This is the first Label"
fontSize="10"/>
<mx:HBox>
<mx:Label text="This is the second Label in the application" fontSize="15" />
<mx:Label text="This is the third Label in the application" fontSize="15" />
</mx:HBox>
<mx:VBox>
<mx:Label text="This is the fourth Label in the application" fontSize="20" />
<mx:Label text="This is the fifth Label" fontSize="20" />
</mx:VBox>
</mx:Application>

Output:

No comments: