Here is my code to center the window and set it to 20% wide and 50% high (of the users screen)
protected function windowedapplication1_preinitializeHandler(event:FlexEvent):void
//gets the available screen height and width
var scrheight:int = Screen.mainScreen.bounds.height;
var scrwidth:int = Screen.mainScreen.bounds.width;
//sets login state to 20%width of screen and 50%height
nativeWindow.width = scrwidth * 0.2;
nativeWindow.height = scrheight * 0.5;
Centers the window
nativeWindow.x =(scrwidth - nativeWindow.width) / 2;
nativeWindow.y =(scrheight - nativeWindow.height) / 2;
However once the user logs in i change state and want to change the size of the window to 80% width and 80% height. This is where i'm not sure how to.
In my opening tags i can specifiy and get to work:
but if i try width.State2 = "80%" nothing happens.
Why doesn't the above work?
How do i make my air app fit all screens resolutions?
Thanks a lot
The answer to your first question is probably -
percentWidth.State2 = 80
(I don't have an answer to your second question)
thanks but that didn't work. The docs say you can specify a percentage using width but it doesn't work
you can specify a percentage width in mxml but in AS you have to use percentWidth