Stage.scaleMode Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
Stage.scaleMode Property Flash 6; partially available through fscommand() since Flash 3

dictates how the movie is sized, relative to the Player read/write
Stage.scaleMode

Description

The string scaleMode property governs how the movie scales (resizes) when the Flash Player's available space does not match the movie's Stage dimensions set at authoring time via Modify figs/u2192.gif Document figs/u2192.gif Dimensions. The allowed settings for scaleMode are:

"exactFit"

Forces every edge of the movie to the edge of the Player, distorting the movie's aspect ratio, if necessary, to fit the available space.

"showAll"

Fits the width or height of the movie to the smaller of the width or height of the Player. The movie will not be cropped or skewed to fit the Player, but there will be borders around the movie (according to the current setting of Stage.align). By default, either the top and bottom or right and left of the movie will have a border.

"noBorder"

Fits the height or width of the movie to the larger of the width or height of the Player. When the aspect ratio of the movie does not match the aspect ratio of the Player, the movie will be cropped according to the current setting of Stage.align. By default, either the top and bottom or both sides will be cropped.

"noScale"

Preserves the movie's author-time size. When the Player is smaller than the movie, the movie is cropped; when the Player is larger than the movie, the excess space displays the movie's background color. Positioning of the movie is controlled by the Stage.align property.

The default scaleMode for the Standalone Player and web browser plugin is "showAll". The default scaleMode for Test Movie mode is "noScale".

The scaleMode property normally is used in concert with the align property and the onResize( ) event for movies with dynamically positioned content.

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

Usage

In Flash Player versions 3 through 5, the equivalent of Stage.scaleMode = "noScale" can be achieved via fscommand("allowscale", "false").

Example

// Distort the movie to fill the Player area Stage.scaleMode = "exactFit";     // Prevent scaling completely, regardless of the size of the Player Stage.scaleMode = "noScale";

See Also

Stage.addListener( ), Stage.align, Stage.onResize( )



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net