Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 165

Programming actionscript 3.0
Table of Contents

Advertisement

In ActionScript 3.0, when you move a display object to a new position in the child list of a
DisplayObjectContainer instance, the other children in the display object container are
repositioned automatically and assigned appropriate child index positions in the display
object container.
Also, in ActionScript 3.0 it is always possible to discover all of the child objects of any display
object container. Every DisplayObjectContainer instance has a
property, which
numChildren
lists the number of children in the display object container. And since the child list of a
display object container is always an indexed list, you can examine every object in the list from
index position 0 through the last index position (
). This was not possible
numChildren - 1
with the methods and properties of a MovieClip object in ActionScript 1.0 and 2.0.
In ActionScript 3.0, you can easily traverse the display list sequentially; there are no gaps in
the index numbers of a child list of a display object container. Traversing the display list and
managing the depth of objects is much easier than was possible in ActionScript 1.0 and 2.0.
In ActionScript 1.0 and 2.0, a movie clip could contain objects with intermittent gaps in the
depth order, which could make it difficult to traverse the list of object. In ActionScript 3.0,
each child list of a display object container is cached internally as an array, resulting in very
fast lookups (by index). Looping through all children of a display object container is also very
fast.
In ActionScript 3.0, you can also access children in a display object container by using the
method of the DisplayObjectContainer class.
getChildByName()
Full traversal of the display list
In ActionScript 1.0 and 2.0, you could not access some objects, such as vector shapes, that
were drawn in the Flash authoring tool. In ActionScript 3.0, you can access all objects on the
display list—both those created using ActionScript and all display objects created in the Flash
authoring tool. For details, see
"Traversing the display list" on page
171.
Off-list display objects
In ActionScript 3.0, you can create display objects that are not on the visible display list.
These are known as off-list display objects. A display object is added to the visible display list
only when you call the
or
method of a DisplayObjectContainer
addChild()
addChildAt()
instance that has already been added to the display list.
Understanding the display architecture
165

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents