User Guide
350 Handling Events
The event flow
Flash Player dispatches event objects whenever an event occurs. If the event target is not on
the display list, Flash Player dispatches the event object directly to the event target. For
example, Flash Player dispatches the progress event object directly to a URLStream object. If
the event target is on the display list, however, Flash Player dispatches the event object into
the display list, and the event object travels through the display list to the event target.
The event flow describes how an event object moves through the display list. The display list is
organized in a hierarchy that can be described as a tree. At the top of the display list hierarchy
is the Stage, which is a special display object container that serves as the root of the display list.
The Stage is represented by the flash.display.Stage class and can only be accessed through a
display object. Every display object has a property named
stage that refers to the Stage for
that application.
When Flash Player dispatches an event object, that event object makes a roundtrip journey
from the Stage to the target node. The DOM Events Specification defines the target node as
the node representing the event target. In other words, the target node is the display list object
where the event occurred. For example, if a user clicks on a display list object named
child1,
Flash Player will dispatch an event object using
child1 as the target node.
The event flow is conceptually divided into three parts. The first part is called the capture
phase; this phase comprises all of the nodes from the Stage to the parent of the target node.
The second part is called the target phase, which consists solely of the target node. The third
part is called the bubbling phase. The bubbling phase comprises the nodes encountered on
the return trip from the parent of the target node back to the Stage.
The names of the phases make more sense if you conceive of the display list as a vertical
hierarchy with the Stage at the top, as shown in the following diagram:
Stage
Parent Node
Child1 Node
Child2 Node