Search code examples
actionscript-3flashair

resize stage in Adobe AIR windows application


I'm realizing an app that runs on a single display in HD and in another setup on two screens. I'm using the none flag to make windows without borders.

Ok, how can I change my fla size after loading the my settings, in authoring the stage size is 3840x1080. how can I get 1920 width?


Solution

  • When using AIR, you can control this via the NativeWindow.bounds property. You may need to add an event listener to the stage so that you don't access its window before activation (i.e. stage.addEventListener(Event.ACTIVATE, onActivate);) and then add the following:

    stage.nativeWindow.bounds = new Rectangle(0, 0, 1920, 1080);
    [or]
    NativeApplication.nativeApplication.activeWindow.bounds = new Rectangle(0, 0, 1920, 1080);
    

    Note that if you do have any system chrome, there will be a difference between the stage size and the window size: you can always take the existing values and do some quick maths to work out how much space is used by the titlebar/borders and adjust your new rectangle appropriately.