I use event.target in the current application I'm developing.

It's nice in MouseEvents for determing what is currently under the mouse and not what dispatches the event.

On Thu, 05 Jun 2008 14:17:43 +0200, EECOLOR <[EMAIL PROTECTED]> wrote:

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
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to