The switch from Actionscript 2.0 to Actionscript 3.0 saw many changes, as we all know. Some were superficial or minor, like removing underscores from certain properties. So _alpha became alpha. The range of alpha became 0 to 1 (formerly 0 to 100). These are among the small changes. Other changes were more extensive; some much more. Of all the changes, the two biggest ones were undoubtedly the display list and the event model. In fact, if you can master these two aspects of Actionscript 3.0, the remainder should be relatively easy.

Of those two, the display list is the easiest to learn. So that leaves the event model. The new event model relies on a system of event dispatchers and event listeners. The event dispatchers are the various objects in your flash movie. If you create things that can be displayed on the screen, you are creating event dispatchers, because in Actionscript 3.0 all display objects ultimately descend from the EventDispatcher class. So our old familiar friend from Actionscript 2.0, the MovieClip, is now an event dispatcher in Actionscript 3.0! So are all of the other display objects. And many objects that aren't display objects are event dispatchers, too, but those won't be the focus of this article. What we are concerned with here is what is known as the event flow. When a display list is involved, and an event is dispatched by an object on the display list, that event is sent through the display list from object to object, looking for event listeners that have been defined along the way. In this article, you are going to see just how useful that feature can be!

A listener is a function that you write to handle events that are being dispatched. A listener is registered with an event dispatcher using the event dispatcher's addEventListener() method. Even if you are quite new to Actionscript 3.0, you probably have already written some event listener functions and added them to MovieClip instances, because you have to if you want to get any kind of interactivity at all. Maybe you've heard of the event flow, and the associated terminology, and wondered what it was all about, especially in terms of how to make it work for you in your projects, but you were put off because it sounded way too complicated. So you just continue on, adding an event listener to each and every object for each and every kind of event you want to listen for, racking up a huge stack of event listeners, while at the same time having this nagging thought that there must be a better way, something powerful that you're not tapping into and taking advantage of.

That something is the event flow, naturally. Trouble is, it can be very intimidating and confusing at first, as you may have already found out (in the end though, it's not all that bad--and that's the good news)! So, if you've read books, seen diagrams, and consulted the documentation--and still don't understand exactly how it works, let alone what it can do for you, don't worry. I'm betting that you're not alone--and that's why I wrote this article.