my application launches with the stage size of 1000 x 500, 2:1 aspect ratio. the native window has system chrome, which will always be a little taller by a few pixels.
how is it possible to only permit a native window to resize proportionately in order to always maintain the 2:1 aspect ratio of the stage?
the following code doesn't work as i expect:
package
{
//Imports
import flash.display.NativeWindow;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.NativeWindowBoundsEvent;
//Class
[SWF(width="1000", height="500", frameRate="60", backgroundColor="#000000")]
public class WindowTest extends Sprite
{
//Constants
private static const ASPECT_RATIO:Number = 2.0; //2:1 Aspect Ratio
//Constructor
public function WindowTest()
{
init();
}
//Initialization
private function init():void
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZE, windowResizeEventHandler);
}
//Window Resize Event Handler
private function windowResizeEventHandler(evt:NativeWindowBoundsEvent):void
{
evt.currentTarget.width = stage.stageHeight * ASPECT_RATIO;
}
}
}