Resizing Flex Dialog to Flash Dimensions
Not long ago, we had created a flex dialog with fixed width and height, which gave users with less screen resolution a real problem. The dialog was opening with the titlebar and close buttons outside the screen. Hence, the dialog couldn’t be closed and it couldn’t be moved.
Here is how to make the dialog resize itself according to the screen estate that the flash has been given:
<?xml version="1.0" ?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete()">
<mx:Script><![CDATA[
import mx.core.Application;
private function onCreationComplete() : void {
height = Application.application.stage.height - 20;
width = Application.application.stage.width - 20;
}
]]></mx:Script>
</mx:Panel>
It is really simple. You go through the Application singleton to reach the Stage. And the stage know about the width and height of the flash.


[...] Tech Per » Blog Archive » Resizing Flex Dialog to Flash Dimensions [...]
December 2nd, 2008 at 14:57Just a quick note:
I found it better to simply use “Application.application.height”, instead of going through the “stage” instance.
I had a problem with incorrectly reported height from the “stage.height” property when in a popped up, modal Panel instance. Strange.
December 2nd, 2008 at 21:20