In my application.xml I can set the position of the initial window. However this is set in pixels from the top left corner of the screen.
So how would I centre it?
In my application.xml I can set the position of the initial window. However this is set in pixels from the top left corner of the screen.
So how would I centre it?
put this into application's creationComplete
event handler
var screenBounds:Rectangle = Screen.mainScreen.bounds;
nativeWindow.x = (screenBounds.width - nativeWindow.width) / 2;
nativeWindow.y = (screenBounds.height - nativeWindow.height) / 2;
Try this one(this is JavaScript):
var bounds = null;
var screen = air.Screen.mainScreen.visibleBounds;
bounds = new air.Rectangle(
(screen.width - WINDOW_WIDTH ) / 2,
(screen.height - WINDOW_HEIGHT) / 2,
WINDOW_WIDTH,
WINDOW_HEIGHT
);
htmlLoader.stage.nativeWindow.bounds = bounds;