--- In [email protected], Nithya R <[EMAIL PROTECTED]> wrote:

>   i have 5 buttons inside a panel in an application... i want to
fetch all the containers and controls in the application in an array..
is there any way to do it?

Use numChildren and getChildAt to iterate over the children and store
references to them into the array.

e.g.

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
  <mx:Panel id="panel" title="Panel">
    <mx:Button label="1" />
    <mx:Button label="2" />
    <mx:Button label="3" />
    <mx:Button label="4" />
    <mx:Button label="5" />
  </mx:Panel>
  <mx:Button label="Iterate" click="iterate()" />
  <mx:Script>
    <![CDATA[
    function iterate():Void
    {
      var n:Number = panel.numChildren;
      var a:Array = new Array(n);
      for (var i:Number = 0; i < n; i++)
        a[i] = panel.getChildAt(i);
      // 'a' contains references to buttons
    }
    ]]>
  </mx:Script>
</mx:Application>

Manish





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to