----- Original Message ----- From: "Rafael Faria" <[EMAIL PROTECTED]> To: <flexcoders@yahoogroups.com> Sent: Thursday, November 22, 2007 3:59 AM Subject: [flexcoders] Re: Flex Hierarchy
> Peter, > > this is just to ilustrate... just did it here in the textarea... didnt > even compiled. > > > if you want a real example... > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute" creationComplete="init()"> > <mx:Script> > <![CDATA[ > import mx.controls.TextInput; > > function init():void > { > var ipt:TextInput = new TextInput(); > ipt.name = "test_input"; > ipt.id = "test_input"; > ipt.addEventListener(Event.ADDED_TO_STAGE,traceInput); > addChild(ipt); > > > > } > > function traceInput(evt:Event):void > { > trace(this['test_input']); > } > ]]> > </mx:Script> > </mx:Application> > > > > tell me why this['test_input'] doesnt work.... and HOW i'm suppose to > make it work.... > > how i'm suppose to make reference to an object that i'm creating > dynamically and adding to the stage... how do i access the staging. > > I hope it's clear now. Clear as mud. You haven't added any object to the stage called 'test_input'.. > > thanks > raf > > > --- In flexcoders@yahoogroups.com, "Peter Hall" <[EMAIL PROTECTED]> wrote: >> >> I'm surprised that even compiles... >> >> Peter >> >> >> On Nov 22, 2007 12:59 AM, Alex Harui <[EMAIL PROTECTED]> wrote: >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > I would avoid name collisions between functions and ids. >> > >> > >> > >> > ________________________________ >> > >> > >> > From: flexcoders@yahoogroups.com > [mailto:[EMAIL PROTECTED] On >> > Behalf Of Rafael Faria >> > Sent: Wednesday, November 21, 2007 4:57 PM >> > To: flexcoders@yahoogroups.com >> > Subject: [flexcoders] Flex Hierarchy >> > >> > >> > >> > >> > >> > >> > >> > >> > When i understand it my life will be so much easier... >> > >> > Look the code above... >> > >> > see that on the function "test2" it doesnt return the proper object? >> > >> > I know that exist some kind of hierarchy.... but what i couldnt > get it >> > is how i get the object that is on the global scope. >> > >> > i tried this.parent, this.parentDocument, this.parentApplication.... >> > all of them and none of them seem to be working... >> > >> > someone can help me?!!?! >> > >> > thanks >> > >> > <?xml version="1.0" encoding="utf-8"?> >> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >> > creationComplete="init()"> >> > <mx:Button id="test" label="Test" /> >> > <mx:Canvas id="test2" label="testing" /> >> > </mx:Application> >> > >> > <mx:Script> >> > <![CDATA[ >> > function init() >> > { >> > test(); >> > test2(); >> > >> > function test2() >> > { >> > trace(this['test2']); >> > } >> > } >> > >> > function test() >> > { >> > trace(this['test2']) // return The object i want >> > } >> > >> > ]]> >> > </mx:Script> >> > >> > >> > > > > > -- > 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 > > > >