0 Replies Latest reply on Jul 18, 2007 10:04 AM by m_hartnett

    Find position of object in VBox

    m_hartnett Level 3
      Hi All,

      I have a outter VBOX that gets populated dynamically with VBOX that contain text and buttons.
      The architecture of the containers is below.

      <VBOX>
      <VBOX>
      <text>Item One<text/>
      <Button/>
      </VBOX>
      <VBOX>
      <text>Item Two<text/>
      <Button/>
      </VBOX>
      </VBOX>

      The objects that are in the outer VBOX box are created dynamically and do not have explicit heights.

      QUESTION: How can I get the height of each of the items in the outter VBOX?
      I have been doing the following:

      //Get the children of the outter VBOX
      var childList : Array = al.listBox.getChildren();
      var total : int= 0;
      for(var i1:int =0;i1<childList.length;i1++) {
      var child :Object = childList[i1];
      var childRect : Rectangle = child.getBounds(container holding the item);
      total = total + childRect.height;
      }

      The getbounds call always returns 0 as well as the x and y coord return 1.
      Any suggestions would be appreciated.