views:

72

answers:

1

I'm working with a Flash movie and I'm trying to get the size of the player itself (i.e. the height and width Flash has to work with from the object/embed tag). As far as I can tell, Flash doesn't make this available to ActionScript.

I'm able to use this.root.loaderInfo.width and this.root.loaderInfo.height to get the "intended" size of the flash movie (what's specified on export), but if the dimensions are different on the page, this isn't helpful.

+2  A: 

Use stage.stageWidth and stage.stageHeight. You have to set stage.scaleMode to StageScaleMode.NO_SCALE for those to work.

sharvey
That, too, delivers the "intended" size, not the actual size.
futuraprime
I'm actually pretty sure this gives you the dimension of the player's stage. try stage.addEventListener(Event.RESIZE, ...) and see if the size you're looking for ever comes up.
sharvey
The event doesn't fire in the browser, though it will in the standalone Flash Player (and it gives the right numbers, too) -- but I'm getting nothing in the browser, even if I deliberately resize the object after loading using JavaScript.
futuraprime
Is you stage.scaleMode is to StageScaleMode.NO_SCALE?
sharvey
Ah! No, it's not--and setting it to that makes it work now. Thanks!
futuraprime