Chapter 4. The Display List
IN THIS CHAPTER
Jump Right In
The Sum of Its Parts
Adding and Removing Children
Managing Object Names, Positions, and Data Types
Changing the Display List Hierarchy
A Dynamic Navigation Bar
What’s Next?
One of the most dramatic changes introduced by ActionScript 3.0, particularly for designers accustomed to prior versions of ActionScript, is the way in which visual elements are added to an application at runtime. In prior versions of ActionScript, a separate approach was used to add most kinds of visual assets at runtime, requiring varied syntax. Management of those assets—particularly depth management—and creating and destroying objects, were also fairly restrictive and could be relatively involved, depending on what you were trying to accomplish.
ActionScript 3.0 brings with it an entirely new way of handling visual assets. It’s called the display list. It’s a hierarchical list of all visual elements in your file. It includes common objects such as movie clips, but also objects such as shapes and sprites that either didn’t previously exist or could not be created programmatically.
The biggest difference between the ActionScript 3.0 display list display techniques used in prior versions of ActionScript is that the display list can’t have any gaps. If the display list contains 10 display objects (such as 10 movie clips), you can’t add a new display object to position 20. Furthermore, if something is removed from the display list, any display objects at a higher ...