Adobe Air - Flash - Window start position

I am developing a desktop application with Adobe Flash CS6 using Air 3.2 for desktop (in flash settings). There is an advanced tab in the air settings that allows you to set an initial value for the position of the application window. I don't know how I should set it in the middle of the screen.

here is a screenshot:

enter image description here

+3


source to share


3 answers


Don't use these properties, just add some code to your application:



stage.nativeWindow.x = (Capabilities.screenResolutionX - this.width)*0.5;
stage.nativeWindow.y = (Capabilities.screenResolutionY - this.height)*0.5;

      

+4


source


For an HTML / JS based AIR project, you can use:



window.moveTo(Math.round((window.screen.availWidth - window.outerWidth) / 2), Math.round((window.screen.availHeight - window.outerHeight) / 2));

      

0


source


var screenBounds:Rectangle = Screen.mainScreen.bounds;
stage.nativeWindow.x = (screenBounds.width - stage.nativeWindow.width) / 2;
stage.nativeWindow.y = (screenBounds.height - stage.nativeWindow.height) / 2;

      

Works for me

0


source







All Articles