Andy Moore
Andy Moore

Reputation: 865

How to find original Flash Dimensions?

I have a flash file I want to programatically find the dimensions of in my code. Right at the beginning of the code I have the string:

[SWF(width='700', height='500')]

And several subclasses later I want to pull these "700" and "500" values up as variables.

Is there a way to find this?

I've tried referencing this.width and this.height but they always end up zero for the parent canvas.

Referencing the Stage does not work as it returns the current stage size, not the desired size. For example, if I load the SWF directly and not through a browser, I can scale the viewport to be as big or small as I like.

Upvotes: 1

Views: 1410

Answers (1)

Josh Tynjala
Josh Tynjala

Reputation: 5240

stage.stageWidth and stage.stageHeight will refer to the full width and height of the stage. It will change at runtime if the instance of Flash Player changes size. There's also loaderInfo.width and loaderInfo.height, which should tell you the original values specified in the [SWF] metadata, and they won't change at runtime.

Upvotes: 1

Related Questions