Flash CS4 Professional ActionScript 2.0

scaleMode (Stage.scaleMode property)

public static scaleMode :  String

Indicates the current scaling of the SWF file within Flash Player. The scaleMode property forces the SWF file into a specific scaling mode. By default, the SWF file uses the HTML parameters set in the Publish Settings dialog box.

The scaleMode property can use the values "exactFit", "showAll", "noBorder", and "noScale". Any other value sets the scaleMode property to the default "showAll".

  • showAll (Default) makes the entire Flash content visible in the specified area without distortion while maintaining the original aspect ratio of the. Borders can appear on two sides of the application.
  • noBorder scales the Flash content to fill the specified area, without distortion but possibly with some cropping, while maintaining the original aspect ratio of the application.
  • exactFit makes the entire Flash content visible in the specified area without trying to preserve the original aspect ratio. Distortion can occur.
  • noScale makes the size of the Flash content fixed, so that it remains unchanged even as the size of the player window changes. Cropping may occur if the player window is smaller than the Flash content.

NOTE the default setting is showAll, except when in test movie mode, where the default setting is noScale

Availability: ActionScript 1.0; Flash Player 6

Example

The following example demonstrates various scale settings for the SWF file. Add a ComboBox instance to your document with the instance name scaleMode_cb. Add the following ActionScript to your FLA or AS file:

var scaleMode_cb:mx.controls.ComboBox;
scaleMode_cb.dataProvider = ["showAll", "exactFit", "noBorder", "noScale"];
var cbListener:Object = new Object();
cbListener.change = function(evt:Object) {
    var scaleMode_str:String = evt.target.selectedItem;
    Stage.scaleMode = scaleMode_str;
};
scaleMode_cb.addEventListener("change", cbListener);

For another example, see the Flash Samples page at www.adobe.com/go/learn_fl_samples. Download and decompress the Samples zip file and go to the ActionScript2.0\StageSize folder to access the stagesize.fla file.