Chapter 14. Organizing Objects with the Display List
When you create your animation using the Flash authoring tool, you draw objects on the stage or drag them from the Library. Often, you put one object inside another. For example, you might place a shape and some text inside a movie clip that’s on the stage. Then you can move or transform the movie clip and its content as a whole. When you want one displayed object to appear in front of or behind another, you use Flash’s Modify→Arrange commands. To a designer, it all seems pretty natural. But what happens when you put on your ActionScript programmer’s hat and want to do those same display-related chores using only ActionScript? The key is the Display List, and that’s the sole topic of this chapter.
The Display List is exactly what its name implies. It’s a running list of the objects displayed during a Flash animation. You make things visible by adding them to the Display List and make them disappear by removing them from the list. The Display List keeps track of the stacking order of objects on the stage, managing the way they overlap one another. This chapter shows you how to add and remove items from the Display List and how to manage the stacking order. You’ll learn a lot about the DisplayObject and DisplayObjectContainer classes. At the end of the chapter (Swapping the Position of Two Children), there’s a handy reference for some of the most common properties and methods related to Display List tasks.