10.10 Values of the this Keyword

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 10.  Events and Event Handling

In our study of ActionScript's event handling tools, we've encountered the this keyword several times. Within an event handler, this normally refers to the object that received notification of the event. However, Flash's evolution through multiple event systems has complicated the issue. Table 10-2 provides a guide to the values of the this keyword in ActionScript's various event handling mechanisms.

Table 10-2. Values of the this keyword

Event handling mechanism

Value of this

Event handler property

The object that defines the handler property.

Event listener method

The object registered as a listener.

MovieClip with event handler property

The movie clip that defines the handler property.

MovieClip with on( ) handler

The clip that bears the handler in the authoring tool.

MovieClip with onClipEvent( ) handler

The clip that bears the handler in the authoring tool.

Button with event handler property

The button that defines the handler property.

Button with on( ) handler

The clip on whose timeline the button resides.

     



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net