How to get the width and height in ActionScript for a Flex application running inside the flash player in the web browser

StackOverflow https://stackoverflow.com/questions/1711734

Question

Does anyone know how to get the width and height in ActionScript for a Flex application running inside the flash player in the web browser.

e.g. In the web browser I can use the tag to embed a Flex application (as a .swf). To the embed tag, I can provide the dimensions. I would like to get these dimensions inside the flex application action script.

Thanks in advance,

Regards

Vivek

Was it helpful?

Solution

I Flex you can access Application.application.height and Application.application.width.

OTHER TIPS

As of Flex 4.0, Adobe recommends using FlexGlobals.topLevelApplication instead of Application.application.

Depending upon what you are doing, you can look into using stage. But, if you do, be aware that the stage will grow to contain movie clips that go outside of the bounds of the application. So the stage is frequently larger than the actual application.

You can use stage.stageWidth/stage.stageHeight. Be sur to call that from a DisplayObject that is on the display list or else stage is going to be null. It works for both Flex and Actionscript projects.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top