Created
May 16, 2011 22:09
-
-
Save peterblazejewicz/975491 to your computer and use it in GitHub Desktop.
center application NativeWindow on screen with semi-transparent background and content centered on screen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" | |
| xmlns:s="library://ns.adobe.com/flex/spark" | |
| xmlns:mx="library://ns.adobe.com/flex/mx" | |
| width="800" height="600" | |
| backgroundAlpha="0.90" backgroundColor="#000000" | |
| initialize="visible = false" | |
| creationComplete="setupStage();" > | |
| <!-- --> | |
| <fx:Script> | |
| <![CDATA[ | |
| // setup stage align and maximize window | |
| private function setupStage():void | |
| { | |
| if(stage) | |
| { | |
| stage.scaleMode = flash.display.StageScaleMode.NO_SCALE; | |
| stage.align = ""; | |
| } | |
| this.nativeWindow.addEventListener(NativeWindowBoundsEvent.RESIZE, finishSetup); | |
| this.nativeWindow.maximize(); | |
| }; | |
| // when window is maximized show window on screen to avoid content flickering | |
| private function finishSetup(resizeEvent:NativeWindowBoundsEvent):void | |
| { | |
| this.nativeWindow.removeEventListener(NativeWindowBoundsEvent.RESIZE, finishSetup); | |
| this.visible = true; | |
| } | |
| ]]> | |
| </fx:Script> | |
| <s:Panel width="800" height="600" horizontalCenter="0" verticalCenter="0"> | |
| <s:controlBarContent/> | |
| </s:Panel> | |
| </s:WindowedApplication> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment