In the previous example, we extended the
Sprite class to develop composite structures that
display on stage. We first add the object to the composite structure, and
subsequently add it to the display list using the
addChild() method. What's the display list in
ActionScript 3.0 applications? The display list is a tree structure with the
stage as its root node. It consists of all the visible
elements that'll be displayed on the stage. The display list consists of two types
of objects: (1) display objects and (2) display object containers. Every element
that appears on the stage is a type of display object. In
contrast, display object containers not only have a visual
representation on the stage, they can also have other display objects, and display
object containers as children.
Close examination of the inheritance structure of the
Sprite class will show two classes called
DisplayObjectContainer in its inheritance hierarchy.
DisplayObject class consists of methods and
properties that deal mainly with the visual presentation of an object such as the
properties that represent its position. The
DisplayObjectContainer class inherits from
DisplayObject, defines necessary properties, and implements methods
to handle child objects (see the ActionScript 3.0 documentation for more detail).
Some of the child handling methods implemented by the
DisplayObjectContainer class are listed below.