Hey, I have been trying to creator a custom window for an AIR for desktop App.
minimize and close is a breese but maximize and restore is a bit tricky.
I set my stage to NO_SCALE.
private function restoreWindow(e:MouseEvent):void
{
if (stage.nativeWindow.displayState != NativeWindowDisplayState.MAXIMIZED)
{
stage.nativeWindow.maximize();
restoreIcon_mc.gotoAndPlay(2);
MovieClip(this.parent).stageBackground_mc.width = stage.stageWidth; //stage is 1280
MovieClip(this.parent).stageBackground_mc.height = stage.stageHeight; //stage is 800
this.x = stage.width * .95;
this.y = 6;
trace(stage.stageWidth, stage.stageHeight)
}
else
{
stage.nativeWindow.restore();
restoreIcon_mc.gotoAndPlay(1);
MovieClip(this.parent).stageBackground_mc.width = stage.stageWidth; //stage is 1845
MovieClip(this.parent).stageBackground_mc.height = stage.stageHeight; //stage is 1080
this.x = stage.width * .91;
this.y = 0;
trace(stage.stageWidth, stage.stageHeight) //traces the size of the restored window
}
}
I don't understand why stage.stageWidth is the original window size(1280 800) when maximized and the maximized size(1845 1080) when restored.
Thanks