User Guide

Working with display objects 173
If you use Flex, you should know that Flex defines many component display object classes,
and these classes override the display list access methods of the DisplayObjectContainer class.
For example, the Container class of the mx.core package overrides the
addChild() method
and other methods of the DisplayObjectContainer class (which the Container class extends).
In the case of the
addChild() method, the class overrides the method in such a way that you
cannot add all types of display objects to a Container instance in Flex. The overridden
method, in this case, requires that the child object that you are adding be a type of
mx.core.UIComponent object.
Setting Stage properties
The Stage class overrides most properties and methods of the DisplayObject class. If you call
one of these overridden properties or methods, Flash Player throws an exception. For example,
the Stage object does not have
x or y properties, since its position is fixed as the main
container for the application. The
x and y properties refer to the position of a display object
relative to its container, and since the Stage is not contained in another display object
container, these properties do not apply.
Controlling the playback frame rate
The framerate property of the Stage class is used to set the frame rate for all SWF files loaded
into the application. For more information, see the ActionScript 3.0 Language Reference.
Working with full-screen mode
Full-screen mode allows you to make a SWF fill a viewers entire monitor, without any
borders, menu bars, and so forth. The Stage classs
displayState property is used to toggle
full-screen mode on and off for a SWF. The
displayState property can be set to one of the
values defined by the constants in the flash.display.StageDisplayState class. To turn on full-
screen mode, set
displayState to StageDisplayState.FULL_SCREEN:
// mySprite is a Sprite instance, already added to the display list
mySprite.stage.displayState = StageDisplayState.FULL_SCREEN;
To exit full-screen mode, set the displayState property to StageDisplayState.NORMAL:
mySprite.stage.displayState = StageDisplayState.NORMAL;
NOTE
Some properties and methods of the Stage class are not available to display objects that
are not in the same security sandbox as the first SWF file loaded. For details, see “Security
sandboxes” on page 461.