0 Replies Latest reply on Oct 2, 2007 7:36 AM by aceflex

    Get all (deep) children in Application

      Hi there,

      is there a way to get all children in application? in the following code, I can get the button_1, panel_1 only. However, can't get the button_2 inside the panel.

      can I get all children in whole application without knowing the container structure? I am new to Flex and appreciate someone can write sample code to me!


      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="init();">


      import mx.core.UIComponent;

      private var childrenLength:Number;
      private var targetObj:Object;
      private var targetType:String;

      private function init():void {
      addEventListener(MouseEvent.MOUSE_OVER, getNum);

      private function getNum(event:MouseEvent):void{


      private function checkContainer(event:MouseEvent):void{
      childrenLength = UIComponent(event.currentTarget).numChildren;

      for (var i:uint=0; i < childrenLength; i++) {
      targetObj = UIComponent(event.currentTarget).getChildAt(i);
      targetType = getQualifiedClassName(targetObj);


      <mx:Button id="Button_1" label="Button1"/>

      <mx:Panel id="Panel_1" width="250" height="200" layout="absolute">
      <mx:Button id="Button_2" x="79" y="35" label="Button2"/>