Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 354

Programming actionscript 3.0
Table of Contents

Advertisement

The bubbles property
An event is said to bubble if its event object participates in the bubbling phase of the event
flow, which means that the event object is passed from the target node back through its
ancestors until it reaches the Stage. The
indicates whether the event object participates in the bubbling phase. Because all events that
bubble also participate in the capture and target phases, any event that bubbles participates in
all three of the event flow phases. If the value is
phases. If the value is
The eventPhase property
You can determine the event phase for any event object by investigating its
property. The
eventPhase
the three phases of the event flow. The Flash Player API defines a separate EventPhase class
that contains three constants that correspond to the three unsigned integer values, as shown in
the following code excerpt:
package flash.events
{
public final class EventPhase
{
public static const CAPTURING_PHASE:uint = 1;
public static const AT_TARGET:uint
public static const BUBBLING_PHASE:uint
}
}
These constants correspond to the three valid values of the
these constants to make your code more readable. For example, if you want to ensure that a
function named
myFunc()
the following code to test for this condition:
if (e.eventPhase == EventPhase.AT_TARGET)
{
myFunc();
}
The target property
The
property holds a reference to the object that is the target of the event. In some
target
cases, this is straightforward, such as when a microphone becomes active, the target of the
event object is the Microphone object. If the target is on the display list, however, the display
list hierarchy must be taken into account. For example, if a user inputs a mouse click on a
point that includes overlapping display list objects, Flash Player always chooses the object that
is farthest away from the Stage as the event target.
354
Handling Events
Event.bubbles
, the event object does not participate in the bubbling phase.
false
property contains an unsigned integer value that represents one of
is called only if the event target is in the target stage, you can use
property stores a Boolean value that
, the event object participates in all three
true
= 2;
= 3;
eventPhase
eventPhase
property. You can use

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents