Example
The following example displays the Stage dimensions in a dynamically created text field.
When you resize the Stage, the values in the text field update. Create a button with an
instance name
remove_btn
this.createTextField("stageSize_txt", this.getNextHighestDepth(), 10, 10,
100, 22);
stageSize_txt.autoSize = true;
stageSize_txt.border = true;
var stageListener:Object = new Object();
stageListener.onResize = function() {
stageSize_txt.text = "w:"+Stage.width+", h:"+Stage.height;
};
Stage.addListener(stageListener);
remove_btn.onRelease = function() {
stageSize_txt.text = "Removing Stage listener...";
Stage.removeListener(stageListener);
}
Select Control > Test Movie to test this example. The values you see in the text field are
updated when you resize the testing environment. When you click
removed and the values are no longer updated in the text field.
See also
addListener (Stage.addListener method)
scaleMode (Stage.scaleMode property)
public static scaleMode : String
Indicates the current scaling of the SWF file within Flash Player. The
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
property can use the values
scaleMode
. Any other value sets the
"noScale"
(Default) makes the entire Flash content visible in the specified area without
showAll
distortion while maintaining the original aspect ratio of the. Borders can appear on two
sides of the application.
scales the Flash content to fill the specified area, without distortion but possibly
noBorder
with some cropping, while maintaining the original aspect ratio of the application.
makes the entire Flash content visible in the specified area without trying to
exactFit
preserve the original aspect ratio. Distortion can occur.
. Add the following ActionScript to Frame 1 of the Timeline.
"exactFit"
scaleMode
remove_btn
,
,
"showAll"
property to the default
, the listener is
property
scaleMode
, and
"noBorder"
.
"showAll"
Stage
1123
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?