Launching an AIR application maximized

I want my AIR application to launch at 100% width and height, or maximized in PC speak. So I had assumed this would be easy, either by setting the width and height of my WindowedApplication to 100% in my application mxml file, or by doing the same using the width/height nodes  in the application xml [...]

I want my AIR application to launch at 100% width and height, or maximized in PC speak. So I had assumed this would be easy, either by setting the width and height of my WindowedApplication to 100% in my application mxml file, or by doing the same using the width/height nodes  in the application xml file. Neither approach seemed to work…

Instead i resize my application once its fully initialized, using the code below, which grabs the visibleBounds of the main screen (meaning it takes into account the size of the taskbar), and resizes accordingly:

private function onApplicationComplete():void
  1. {
  2.    var screen:Screen = Screen.mainScreen;
  3.  
  4.    this.width = screen.visibleBounds.width;
  5.    this.height = screen.visibleBounds.height;
  6.    this.move(0,0);
  7. }

UPDATE

Thanks to Tim (see comments) theres an even easier way:

stage.nativeWindow.maximize();
 

7 Responses to “Launching an AIR application maximized”

  1. TimHoff says:

    Not sure if this works for WindowedApplication, but for Window this works as well:

    nativeWindow.maximize();

    -TH

  2. Chuckle. Yeah thanks Tim, that does work!

  3. TimHoff says:

    Very cool. There may be some situations though, where re-sizing the app to full-size would be desired.

    -TH

  4. [...] here: Vivace Interactive: Flash / Flex Developer, Auckland New Zealand … Comments [0]Digg [...]

  5. Agent RR007 says:

    One thing that I found difficult was to prevent the user from exiting the FULL SCREEN. One of my ideas was to do a KIOSK so that the user will not be able to interact with the WINDOWS DESKTOP but only with the KIOSK. Any ideas anyone?

    Thanks.

  6. Wallpapers says:

    Огромное вам человеческое спасибо, очень актуальная заметка.

  7. Sel says:

    Thanks for this post. By the way nativeWindow.maximize() works also on WindowedApplication

Leave a Reply



Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...