User Guide

Event objects 355
For complex SWF files, especially those in which buttons are routinely decorated with smaller
child objects, the
target property may not be used frequently because it will often point to a
buttons child object instead of the button. In these situations, the common practice is to add
event listeners to the button and use the
currentTarget property because it points to the
button, whereas the
target property may point to a child of the button.
The currentTarget property
The
currentTarget property contains a reference to the object that is currently processing
the event object. Although it may seem odd not to know which node is currently processing
the event object that you are examining, keep in mind that you can add a listener function to
any display object in that event object's event flow, and the listener function can be placed in
any location. Moreover, the same listener function can be added to different display objects.
As a project increases in size and complexity, the
currentTarget property becomes more and
more useful.
Understanding Event class methods
There are three categories of Event class methods:
Utility methods, which can create copies of an event object or convert it to a string
Event flow methods, which remove event objects from the event flow
Default behavior methods, which prevent default behavior or check whether it has been
prevented
Event class utility methods
There are two utility methods in the Event class. The clone() method allows you to create
copies of an event object. The
toString() method allows you to generate a string
representation of the properties of an event object along with their values. Both of these
methods are used internally by the event model system, but are exposed to developers for
general use.
For advanced developers creating subclasses of the Event class, you must override and
implement versions of both utility methods to ensure that the event subclass will work
properly.