Table of Contents

10.10 Values of the this Keyword

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.


Table of Contents