Suppose you create a TextInput
object.
import fl.controls.TextInput;
import flash.events.MouseEvent;
var t:TextInput;
function init():void {
t = new TextInput();
t.x = 100;
t.y = 100;
t.width=100;
t.height=30;
t.addEventListener(MouseEvent.CLICK, fresult);
this.addChild(t);
}
function fresult(e:Event):void {
trace(e.target);
trace(e.currentTarget);
}
init();
Clicking on the TextInput gives the trace of:
[object TextField]
[object TextInput]
This means:
event.target
is the object from which the event originated. i.e. in this case, a TextField was clicked on, so the event originated from the TextField
.
event.currentTarget
is the object which called the listener. In this case, the TextInput
called the listener, so the currentTarget
is TextInput