Is it possible to specify the display dimensions of a directly linked .swf

flash

Directly-linked .swf files, i.e not embedded in a web page, seem to render at 100% of the browser window size. Is it possible to specify in the .swf file itself dimensions for the .swf to display at?

Thanks all,

Richard.

Best Answer

In AS2:

Add the following code at the second frame (leave the first frame blank, putting the code in the first frame might give you false values):

Stage.scaleMode = "noScale";

Then you can access the stage's width & height using:

var myWidth:Number = Stage.width;
var myHeight:Number = Stage.height;

Note that there is no underscore before the width and height properties. Put your entire movie inside a single movieclip at the root and set it's relative size according to these values.

Let me know if that worked for you. Also: See my answer about the downside of linking directly to SWF files.

Related Topic