Box Layout Container

The box layout container puts its children one after the other depending on the direction specified by the direction attribute of Box container.

Box Layout Container

Box Layout Container

     

The box layout container puts its children one after the other depending on the direction specified by the direction attribute of Box container. By default, it lays its children components in vertical direction but you can change the direction to horizontal by specifying the value "horizontal" to the direction attribute.

But VBox (Vertical Box) and HBox (Horizontal Box) containers can also be used for vertical and horizontal positioning of the child components.

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Box paddingLeft="30" paddingRight="30" paddingTop="50" paddingBottom="50" width="242" backgroundColor="#ADCCD9" x="10" y="19">

<mx:TextInput/>

<mx:Button label="OK"/>

</mx:Box>

<mx:Box direction="horizontal" x="260" paddingLeft="30" paddingRight="30" paddingTop="50" paddingBottom="50" backgroundColor="#ADCCD9" y="19">

<mx:TextInput/>

<mx:Button label="OK"/>

</mx:Box>

</mx:Application>

Output:

Download the source code:

BoxLayoutContainer.zip