Posted on | March 28, 2012 | No Comments
So you have a flash application that looks great in a webpage, but when you view the .swf file directly in the browser it stretches and distorts and looks plain ugly. Fortunately, there is a solution!
By default your flash application will attempt to fill the container it is in, regardless of the width and height settings you have set. It is possible to tell your application ‘Oi! NO!’ by adding this line into your script:
stage.scaleMode = StageScaleMode.NO_SCALE;
If you are including this in a .as file then you will also need to include StageScaleMode:
Here are a couple of examples. The first one does not have stage.scaleMode line of code, while the second does. These are direct links to the .swf files so will both fill the width and height of the browser you are viewing them with.
As you can see, the image in the first one has been stretched with the .swf file.
The second one, the one with scaleMode set, shows the image at the correct size, without any scaling what so ever.
Posted By:Richard Parnaby-King