Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 351

Programming actionscript 3.0
Table of Contents

Advertisement

If a user clicks on
Child1 Node
As the following image shows, the object's journey starts at
, then moves to
Node
again on its journey back to
Parent Node
Stage
Capture
Phase
Parent Node
Child1 Node
Target Phase
In this example, the capture phase comprises
downward journey. The target phase comprises the time spent at
phase comprises
Parent Node
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 button's 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
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.
, Flash Player dispatches an event object into the event flow.
and then "bubbles" back up to
Child1 Node,
Bubbling
Phase
Child2 Node
and
Stage
and
enterFrame
init
Stage
.
Stage
and
Stage
Parent Node
as they are encountered during the upward journey
event types, are dispatched directly to the target
, moves down to
Parent
, moving through
Stage
during the initial
. The bubbling
Child1 Node
The event flow
351

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents