
strating that container controls can have other containers as
children.
Example 4-4. Using both the VBox and the HBox containers
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="#FFFFFF" backgroundAlpha="0">
<mx:VBox horizontalAlign="center" verticalGap="15">
<mx:HBox verticalAlign="middle" horizontalGap="15">
<mx:Button label="< prev" left="10" top="120" />
<mx:Image source="assets/animals03.jpg"
horizontalCenter="0" top="30"/>
<mx:Button label="next >" right="10" top="120"/>
</mx:HBox>
<mx:Label text="Photographed by Elsie Weil"
horizontalCenter="0" top="250"/>
</mx:VBox>
</mx:Application>
Figure 4-4 shows the result of Example 4-4.
The Canvas Container (Absolute Positioning)
Canvas is
the only container that lets you explicitly specify the
location of its children within the container. The Canvas object
has only one layout value: absolute. You can use the x and y
properties of child components for pixel-perfect layouts. If the
display window is resized, the child components stay fixed in
place and may appear cut off. Using absolute positioning you
can make child controls overlap if desired.
Figure 4-3. An HBox layout
The Canvas Container (Absolute Positioning) | 41
Kommentare zu diesen Handbüchern