Well...
i don't think anyone understood what i need so i decided to write a
function to solve my problem. It's not the best way but i might help
someone in the future.
With this function you can use $('children_name') and it will return
the object. It will work like getElementById('') of javascript.
I couldn't find anything that would help me... =/
function $(object:String,container:DisplayObjectContainer = null) {
if (container == null) container = this;
for (var i:uint=0; i < container.numChildren; i++)
{
var child:DisplayObject = container.getChildAt(i);
if (child.name== object) {
return child;
}
if (container.getChildAt(i) is DisplayObjectContainer)
{
var obj = $(object,DisplayObjectContainer(child));
if (obj is DisplayObject) {
return obj;
}
}
}
}
--- In [email protected], "Muzak" <[EMAIL PROTECTED]> wrote:
>
> Use the argument passed to the event handler, that's what it's for.
> currentTarget should give you what you need.
>
> private function init():void {
> var c1:Canvas = new Canvas();
> addChild(c1);
>
> var c2:Canvas = new Canvas();
> c1.addChild(c2);
>
> var c3:Canvas = new Canvas();
> c2.addChild(c3);
>
> var c4:Canvas = new Canvas();
> c3.addChild(c4);
>
> var ipt:TextInput = new TextInput();
> ipt.name = "test_input";
> ipt.id = "test_input";
> ipt.addEventListener(Event.ADDED_TO_STAGE,traceInput);
> c4.addChild(ipt);
> }
>
> private function traceInput(evt:Event):void {
> trace(evt.currentTarget);
> }
>
>
> ----- Original Message -----
> From: "Rafael Faria" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Thursday, November 22, 2007 6:04 AM
> Subject: [flexcoders] Re: Flex Hierarchy
>
>
> I don't think i'm making myself clear.
>
> The whole point is to get the "sbtButton" not the parent.
>
> if you create sbtButton dinamically inside a <vbox><form><button>
> (that will be dynamically as well)
>
> "this.sbtButton" wouldnt work.
>
> Let me try again
>