I’ve come across several different ways how various company Flash Developers use Events. Some discover it for the first time and think its a great concept to pass a notification up the chain to their main application class.
They’ll often try to do something like this:
Hopefully it only takes you 10 seconds to realize that this technique is really messy in the way each dispatchers (ex: a button, a canvas, and the application) has to listen for their child object’s events and in turn dispatch a custom event up to the top of the chain. For one, this change of event-name can easily get confusing, and quite frankly – it is pointless!
Try favoring the use of Flash’s Event Bubbling feature. The following illustration shows the bubbling flow of an event.
As you can see, the event-name is consistent, so our listening candidate (ex: the Stage) can reassuringly listen for the event dispatched by its descendants, at any depth level (direct subchild, or indirect subchild).
Do note however, as soon as another object in between these two listens for the same event, the bubbling will trigger that intermediate object first before it makes it to the top. Just, you know… think of it as – a bubble!