Flash event phases?

Can someone just explain the 3 steps in the event framework, please?

By phase of events, I mean:

  • CAPTURING_PHASE
  • AT_TARGET
  • BUBBLING_PHASE

To be clear, I'm talking about flash.events.Event and subclasses.

A detailed example will be fantastic. What happens when you click on a nested MovieClip ?

+6
events flash actionscript-3
source share
2 answers

When propagating events, you are dealing with three β€œphases” of an event (see Figure 2). Each phase represents the path or location of the event, since it itself works through the displayed objects in Flash that relate to this event. Three phases of the event capture, target and bubbles:

  • Capture phase . This represents the parent of the target from which the event originated. Any common event starts with the uppermost parent (stage) and runs down the hierarchy of display objects until the original goal is reached.

  • At the target stage : the target phase is the phase in which the event is on the target or the object from which it occurred. Unlike the capture and bubbling phases, this phase always refers to only one object, the target object.

  • Bubbling phase : when the bubbling event follows the return path of the capture phase and runs on the path to the parent hierarchy of the target until it reaches the highest parent or stage.

Blissfully Stolen from: An Introduction to Event Processing in ActionScript 3.0

+10
source share

A back, I wrote several articles about event propagation, custom events in Flash, etc.

You can find the article here along with the source code and working examples:

http://www.popamihai.com/2010/10/flex/event-propagation-capturing-phase-targeting-phase-and-bubbling-phase/

The capture phase is encountered externally from the external parent container (in this case, the application tag) to the immediate parent (VGroup tag) of the target.

After all the ancestors are checked for listeners, Flex starts targeting.

The targeting phase is the second phase of the mechanism event propagation, and at this stage Flex checks the event listeners on the target itself.

The third and final stage of the event propagation mechanism is this . . Adjust the targeting phase, now Flex checks all the parent containers of the target for event listeners. This check occurs from the inside out, from the immediate parent of the target to the outermost parent container - in this case, the application tag.

0
source share

All Articles