User Guide
168 Display Programming
Any display objects that you create without using ActionScript—for example, by adding an
MXML tag in Adobe Flex Builder 2 or by using a drawing tool in Flash—are added to the
display list. Although you do not add these display objects through ActionScript, you can
access them through ActionScript. For example, the following code adjusts the width of an
object named
button1 that was added in the authoring tool (not through ActionScript):
button1.width = 200;
Working with display object containers
If a DisplayObjectContainer object is deleted from the display list, or if it is moved or
transformed in some other way, each display object in the DisplayObjectContainer is also
deleted, moved, or transformed.
A display object container is itself a type of display object—it can be added to another display
object container. For example, the following image shows a display object container,
pictureScreen, that contains one outline shape and four other display object containers (of
type PictureFrame):
In order to have a display object appear in the display list, you must add it to a display object
container that is on the display list. You do this by using the
addChild() method or the
addChildAt() method of the container object. For example, without the final line of the
following code, the
myTextField object would not be displayed:
var myTextField:TextField = new TextField();
A shape defining
the border of the
pictureScreen
display object
container
Four display object
containers that are
children of the
pictureScreen
object