hi there,

I am appreciate that someone can help me on the sample code below, I
am new to flex, so I can learn form you guys.

Thanks a lot @v@




--- In flexcoders@yahoogroups.com, "flexawesome" <[EMAIL PROTECTED]> wrote:
>
> 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?
> 
> THANKS
> 
> ===========================================================
> <?xml version="1.0"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> creationComplete="init();">
>       
>       <mx:Script>
>               <![CDATA[
>               
>               import mx.core.UIComponent;
>               
>               private var childrenLength:Number;
>               private var targetObj:Object;
>               private var targetType:String;
>               private var startPos:Number;    
>               private var endPos:Number;                              
>           
>           private function init():void {
>               addEventListener(MouseEvent.MOUSE_OVER, getNum);        
>           }
> 
>               private function getNum(event:MouseEvent):void{
>                       event.preventDefault();
>                       
>                       checkContainer(event);
>               } 
> 
>               
>               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);
>                               trace(targetObj);
>                       }                       
>               }
>               
>               ]]>
>       </mx:Script>
> 
> 
>       <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"/>
>       </mx:Panel>
>               
> </mx:Application>
> ===========================================================
>


Reply via email to