In this tutorial we'll be looking at how to scale your flash movie dynamically using Actionscript 3.0. If you're a common user of Flash then you'll know that the Flash player has it's own default method of scaling movies, this is known as SHOW_ALL scale mode. This scale mode essentially scales your movie so that the whole application is visible while still maintaining it's original size. This is a property of the StageScaleMode class, the StageScaleMode class is full of properties that enable us to change the scale of our published movies, let's take a look at some of the examples below;
Whenever you set the ScaleMode make sure you always import the relevant class, in this case we're using the StageScaleMode class so import that class using the following piece of code;
This is the default scale method.
Next we have the no border scale mode, this mode works similar to the show all mode, the difference is that the no border makes sure the Player doesn't display any borders around the stage. To set the scale mode to no border do the following;
The no scale mode is pretty self explanatory in the fact that it doesn't scale the movie. This means that it will maintain it's original size no matter what the stage size is.
The exactFit mode scales a movie to fit the Player, and it alters the movie's aspect ratio, if necessary, to match that of the Player. The result is that the movie always fills the Player exactly, but the elements of the movie may be distorted. For example:
This post is tagged Actionscript 3, actionscript 3 beginners guide, Adobe CS4, Flash CS3, Scaling
Share This Post
Jobs


























5 Comments
Hi,
I've been trying to use:
stage.scaleMode = StageScaleMode.NO_BORDER;
but it's not working and I have no idea why.
I keep getting this error:
1172: Definition flash.display.StageScaleMode:NO_BORDER could not be found.
first write:
import flash.display.StageScaleMode
and in the next line:
stage.scaleMode = StageScaleMode.NO_BORDER;
thxx
hey its very nice man…
Thanks…
Incoming Links
Leave a Reply