3 Replies Latest reply on Jul 12, 2011 6:53 AM by _spoboyle

    Setting the size of the window(s)

    flexillu10 Level 1

      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:

       

      width.State2="1600"
      

       

      but if i try width.State2 = "80%" nothing happens.

       

      Why doesn't the above work?

      and

      How do i make my air app fit all screens resolutions?

       

      Thanks a lot