I am hoping another set of eyes will catch my error, explain the
behavior, or confirm this just isn't right. Coordinates do not seem to
update when objects in a VBox are moved due to the resizing of one of
the contents:

<?xml version="1.0"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml";
backgroundColor="white" 
        layout="absolute" updateComplete="initializeLayout()">
        
    <mx:Script>        
    <![CDATA[  
      private var uninitialized:Boolean = true;         
      
      private function initializeLayout():void
      {
        if (uninitialized)
        {
                trace("Button X = " + btnX.localToGlobal(new Point(0, 0)));
//x=0, y=0
                trace("Button Y = " + btnY.localToGlobal(new Point(0, 0)));
//x=0, y=25
                trace("Button Z = " + btnZ.localToGlobal(new Point(0, 0)));
//x=0, y=50
                
                btnX.height = 200; //Shifts Buttons Y and Z down.
                
                trace("Button X = " + btnX.localToGlobal(new Point(0, 0)));
//x=0, y=0; no change
                trace("Button Y = " + btnY.localToGlobal(new Point(0, 0)));
//Should be x=0, y=200; I get x=0, y=25
                trace("Button Z = " + btnZ.localToGlobal(new Point(0, 0)));
//Should be x=0, y=225; I get x=0, y=50
                
                uninitialized = false;
        }
      }
                
    ]]>    
    </mx:Script>

    <mx:VBox id="box" verticalGap="0">
        <mx:Button id="btnX" label="Button X" height="25"/>
        <mx:Button id="btnY" label="Button Y" height="25"/>
        <mx:Button id="btnZ" label="Button Z" height="25"/>
    </mx:VBox>
</mx:WindowedApplication>

Reply via email to