I would recommend using event.currentTarget instead of event.target at all
times.

the event.currentTarget property contains a reference to the instance at
which you registered the event listener. event.target refers to the class
that dispatches the event.

In this case there is no difference between .target and .currentTarget, but
in future cases you might encounter problems. The cases where you would use
event.target are so rare that I would urge everyone to allways use
event.currentTarget.


Greetz Erik


On 6/3/08, Rich Shupe <[EMAIL PROTECTED]> wrote:
>
> for (var i:int = 0; i < 3; i++) {
>     var txtFld:TextField = new TextField();
>     txtFld.name = "TextField" + i;
>     txtFld.border = true;
>     txtFld.x = i*120;
>     addChild(txtFld);
>     txtFld.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
> }
>
> function onClick(evt:Event):void {
>     trace("Hi I'm", evt.target.name);
> }
>
>
>
> Rich
> http://www.LearningActionScript3.com
>
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to