0 Replies Latest reply on Jan 14, 2008 5:04 AM by gnraghu

    getBounds of VBox returning different coordinates

    gnraghu
      I have used the getBounds method for getting the bounds of items as you have suggested. This method is returning different coordinates for the same child. I have put the trace statement for returning the bounds of first element in the VBox. This returns the same coordinates from after second iteration.
      Can you please look into the code and let me know, if I am doing any thing wrong?

      ----------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[

      private function testAddfunction() : void
      {
      var newSongBit:Button = new Button();
      songbitpane.addChild(newSongBit);
      var boundRect:Rectangle = songbitpane.getChildAt(0).getBounds(songbitpane);
      trace(boundRect);
      }

      ]]>
      </mx:Script>
      <mx:Panel height="50%" width="50%">
      <mx:VBox width="50%" height="50%" borderThickness="2"
      horizontalAlign="center" verticalScrollPolicy= "auto" verticalGap="10"
      id= "songbitpane" backgroundColor="white">
      </mx:VBox>
      <mx:Button height="30" label="Test Song bit addition"
      click="testAddfunction();"/>

      </mx:Panel>
      </mx:Application>