Table of Contents

Stage.align Property Flash 6

alignment of the movie within the Flash Player read/write
Stage.align

Description

When a movie is embedded in a web page, the HTML OBJECT and EMBED tags can specify dimensions that do not match those of the Flash document. When the movie is displayed in the Standalone Player, the Player can be resized by the user. In both cases, the string align property dictates the positioning of the movie, relative to the space available to the Flash Player. By default, align is the empty string, indicating that the movie should be centered horizontally and vertically in the Player. Table 18-20 lists the available alignment settings:

Table 18-20. Stage.align property values

align property

Description

Horizontal alignment

Vertical alignment

"" (empty string)

centered

center

center

"B"

bottom, center

center

bottom

"T"

top, center

center

top

"L"

left side, center

left

center

"LB"

left, bottom corner

left

bottom

"LT"

left, top corner

left

top

"R"

right side, center

right

center

"RB"

right, bottom corner

right

bottom

"RT"

right, top corner

right

top

The effect of align is most obvious (and most useful) when scaleMode is set to "noScale", in which case the movie does not change size in the Player — it changes placement only.

When the Player is resized, the .swf document it contains is automatically repositioned according to align. To force a custom positioning for elements in a movie at resize time, use the onResize( ) listener event.

When a movie is embedded in a web page, the OBJECT or EMBED tag can also set the value of align; any assignment in ActionScript overrides the HTML setting.

Usage

ActionScript corrects any imprecise assignments of align to match the closest valid setting. For example, assigning "tl" results in "LT", and assigning "jjjt" results in "T". For code clarity, however, the documented settings should always be used.

Example

The following code pins the movie to the top-left corner of the Player:

Stage.scaleMode = "noScale";
Stage.align = "LT";

See Also

Stage.onResize( ), Stage.scaleMode


Table of Contents