Developer Guide
If a user clicks on Child1 Node, Flash Player or AIR dispatches an event object into the event flow. As the following
image shows, the objects journey starts at
Stage, moves down to Parent Node, then moves to Child1 Node, and
then “bubbles” back up to
Stage, moving through Parent Node again on its journey back to Stage.
In this example, the capture phase comprises
Stage and Parent Node during the initial downward journey. The
target phase comprises the time spent at
Child1 Node. The bubbling phase comprises Parent Node and Stage as
they are encountered during the upward journey back to the root node.
The event flow contributes to a more powerful event-handling system than that previously available to ActionScript
programmers. In previous versions of ActionScript, the event flow does not exist, which means that event listeners
can be added only to the object that generates the event. In ActionScript 3.0, you can add event listeners not only to
a target node, but also to any node along the event flow.
The ability to add event listeners along the event flow is useful when a user interface component comprises more
than one object. For example, a button object often contains a text object that serves as the buttons label. Without
the ability to add a listener to the event flow, you would have to add a listener to both the button object and the text
object to ensure that you receive notification about click events that occur anywhere on the button. The existence of
the event flow, however, allows you to place a single event listener on the button object that handles click events that
occur either on the text object or on the areas of the button object that are not obscured by the text object.
Not every event object, however, participates in all three phases of the event flow. Some types of events, such as the
enterFrame and init event types, are dispatched directly to the target node and participate in neither the capture
phase nor the bubbling phase. Other events may target objects that are not on the display list, such as events
dispatched to an instance of the Socket class. These event objects will also flow directly to the target object, without
participating in the capture and bubbling phases.
To find out how a particular event type behaves, you can either check the API documentation or examine the event
object's properties. Examining the event object’s properties is described in the following section.
Event objects
Event objects serve two main purposes in the new event-handling system. First, event objects represent actual events
by storing information about specific events in a set of properties. Second, event objects contain a set of methods
that allow you to manipulate event objects and affect the behavior of the event-handling system.
To facilitate access to these properties and methods, the Flash Player API defines an Event class that serves as the
base class for all event objects. The Event class defines a fundamental set of properties and methods that are common
to all event objects.
Parent Node
Child1 Node
Child2 Node
Target Phase

Get ADOBE® FLEX® 3: PROGRAMMING ACTIONSCRIPT™ 3.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.