flash propagation_concept
Concept
In the article entitled The Event Model we looked into the concept of events and how ActionScript 3 has changed it. Event propagation is an advanced concept in ActionScript 3 and should be looked at further.
The concept of event propagation is inherited from W3C’s the Document Object Model (DOM). You can get the latest specifications here: http://www.w3.org/TR/DOM-Level-3-Events/
In ActionScript 3, only graphic objects are concerned by event propagation. When an event occurs in a display list the Flash player propagates it from the flash.display.Stage object to the direct parent of the originating propagation object.
This event descent is called capture phase. Thanks to this we can subscribe a listener to one of the parent objects which initiated the propagation, in order to be notified during the descending phase. The term capture is used because we can capture the event during its descent and stop its propagation if necessary.
The target phase intervenes when the event has traversed all of the parent objects and has reached the object having caused its propagation. This is called the target object or the target node.
Once the target phase has finished, the Flash player propagates the event in the opposite direction to the capture phase. This phase is called the bubbling phase. During this, the event rises to the Stage object, or in other words to the root of the display list. These three phases which constitute event propagation are shown here:
The events broadcast in ActionScript 2 only had one target phase. These two new phases brought in by ActionScript 3 will allow us to better manage the interaction between graphic objects in the display list.
Be aware that event propagation only concerns graphic objects.
It is important to note that ActionScript 3 is not the only language to integrate the idea of event propagation. Languages like JavaScript or Java have used this mechanism for many years.
We will now look at each of these phases to discover the advantages of event propagation and how to benefit from it in our applications.
Worth remembering
- Event propagation is only for graphic objects
- Event propagation is not unique to ActionScript 3. It is already used in JavaScript, Java or C#.
- The event concept is split into three distinct phases: the capture phase, the target phase and the bubbling phase.
Mediabox Training Centre © 2000 - 2008 All rights reserved.
Adobe Authorized Training Centre. State convention under number 25 14 02167 14.
Mediabox : SARL au capital de 62.000€ - Activity number: 25 14 02167 14 - SIRET : 493 716 468 00027
MEDIABOX, 102 Avenue des Champs Elysées, 75008 PARIS - Tel. +33(0)2.31.91.96.89 - Fax. +33(0)2.72.68.56.42



