views:

347

answers:

1

Could someone simply explain the 3 phases in the Flash Event framework, please?

By event phases, I mean:

  • CAPTURING_PHASE
  • AT_TARGET
  • BUBBLING_PHASE

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

An in-depth example would be fantastic. What happens when you click on a nested MovieClip?

+6  A: 

With event propagation you're dealing with three "phases" of an event (see Figure 2). Each phase represents a path or the location of an event as it works itself through the display objects in Flash that relate to that event. The three phases of an event are capturing, at target, and bubbling:

  • Capturing phase: This represents the parent objects of the target object from which the event originated. Any propagated event starts with the topmost parent (stage) and works down the display object hierarchy until reaching the original target.

  • At target phase: The target phase is the phase where the event is at the target object or the object from which the event originated. Unlike the capturing and bubbling phases, this phase always relates to only one object, the target object.

  • Bubbling phase: When an event "bubbles" it follows the reverse path of the capturing phase and works its way back up the parent hierarchy of the target object until reaching the top-most parent or stage.

Blatantly stolen from: Introduction to event handling in ActionScript 3.0

grapefrukt
Thanks for this. Do you think you could explain what they're used for, perhaps with an example or two? What happens when I click on a nested MovieClip?
aaaidan
Link should be: http://www.adobe.com/devnet/actionscript/articles/event_handling_as3.html
Mike Stead