Thank you everyone who helped me out! currentTarget on the event
object definitely gets me the right reference.

Cheers,
Mark

--- In flexcoders@yahoogroups.com, "Iko Knyphausen" <[EMAIL PROTECTED]> wrote:
>
> Here is a little example... watch the control walk the walk while
you are
> typing...
> 
>  
> 
> <?xml version="1.0" encoding="utf-8"?>
> 
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
> 
>       <mx:Script>
> 
>             <![CDATA[
> 
>                   import flash.events.Event;
> 
>                   
> 
>                   public function myChangeHandler (e:Event) : void
> 
>                   {
> 
>                         e.currentTarget.x +=10;
> 
>                   }
> 
>             ]]>
> 
>       </mx:Script>
> 
>       <mx:TextInput x="27" y="27" text="" 
change="myChangeHandler(event)"/>
> 
> </mx:Application>
> 
>  
> 
>  
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Mark Piller
> Sent: Saturday, November 04, 2006 6:18 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] refering to an MXML element in an event handler
> 
>  
> 
> Suppose I have the following MXML declaration:
> 
> <mx:Canvas id="id0" x="37" y="41" >
> <mx:Text x="25" y="10" text="Some Text" added="addLabel(this)" />
> </mx:Canvas>
> 
> Notice in the "added" handler I use "this" hoping that the scope of
> "this" is the actual Text element. My thinking is incorrect and the
> debugger shows that "this" refers to the top level container (the one
> defined in the same MXML page). So my question is: is there a way to
> refer to that Text element *without* assigning an id to it. I assume
> the following would work, but it is really not ideal for my use-case:
> 
> <mx:Canvas id="id0" x="37" y="41" >
> <mx:Text id="myText" x="25" y="10" text="Some Text"
> added="addLabel(myText)" />
> </mx:Canvas>
> 
> Thanks,
> Mark
>





--
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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> 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