This content has been marked as final. Show 3 replies
To center the initial window of the AIR application at launch:
1. Set the visible property of the initialWindow property of the application descriptor file to false. You can do this in Flash CS3 in Publish Settings: Player Settings: Advanced Settings: Visible.
2. In initialization script for your application, include this ActionScript code (or something like it):
var screen:Screen = Screen.getScreensForRectangle(stage.nativeWindow.bounds);
var desiredWidth:Number = 800;
var desiredHeight:Number = 600;
var windowBounds:Rectangle = new Rectangle();
windowBounds.width = Math.min(desiredWidth, screen.bounds.width);
windowBounds.height = Math.min(desiredHeight, screen.bounds.height);
windowBounds.x = screen.bounds.x + (screen.bounds.width - windowBounds.width)/2;
windowBounds.y = screen.bounds.y + (screen.bounds.height - windowBounds.height)/2;
stage.nativeWindow.bounds = windowBounds;
stage.nativeWindow.visible = true;
swartz1999, Many thanks this seems to have worked just the way I wanted.
Appreciate your time to answer this post.