Macromedia flex 2 Manual

Page of 254
168
Creating Advanced Visual Components in ActionScript
The properties have the following values:
unscaledWidth
Specifies the width of the component, in pixels, in the component’s 
coordinates, regardless of the value of the 
scaleX
 property of the component. This is the 
width of the component as determined by its parent container. 
unscaledHeight
Specifies the height of the component, in pixels, in the component’s 
coordinates, regardless of the value of the 
scaleY
 property of the component. This is the 
height of the component as determined by its parent container.
Scaling occurs in Flash Player, after 
updateDisplayList()
 executes. For example, a 
component with an 
unscaledHeight
 value of 100, and with a 
scaleY
 property of 2.0, 
appears 200 pixels high in Flash Player. 
Overriding the layout mechanism of the VBox container
The 
VBox
 container lays out its children from the top of the container to the bottom of the 
container in the order in which the children are added to the container. The following 
example overrides the 
updateDisplayList()
 method, which causes the VBox container to 
layout its children from the bottom of the container to the top:
package myComponents

    // asAdvanced/myComponents/BottomUpVBox.as
    import mx.containers.VBox;
    import mx.core.EdgeMetrics;
    import mx.core.UIComponent;
    public class BottomUpVBox extends VBox
    {
    
        public function BottomUpVBox() {
            super();
        }
        
        override protected function updateDisplayList(unscaledWidth:Number,
            unscaledHeight:Number):void {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
    
            // Get information about the container border area. 
            // The usable area of the container for its children is the 
            // container size, minus any border areas.
            var vm:EdgeMetrics = viewMetricsAndPadding;
            // Get the setting for the vertical gap between children.
            var gap:Number = getStyle("verticalGap");
    
            // Determine the y coordinate of the bottom of the usable area