Try this code (works for me ) in the 'creationComplete' function of the windowedApplication:
nativeWindow.x = (Capabilities.screenResolutionX - nativeWindow.width) / 2;
nativeWindow.y = (Capabilities.screenResolutionY - nativeWindow.height) / 2;
Hope that helps,
Thanks, I'll give that a try.
Thanks that did the trick.;.. Here is the final code:
stage.nativeWindow.x = (Capabilities.screenResolutionX - stage.nativeWindow.width) / 2;
stage.nativeWindow.y = (Capabilities.screenResolutionY - stage.nativeWindow.height) / 2;
Be careful about using Capabilities.screenResolutionX. In the case of a user running dual monitors, that could cause the app to open smack on the divider between the two monitors.
I do understand what you mean. I run two monitors. This worked ok in the right positioning on my first monitor.
Thanks for the feeddback.
If a user has dual monitors, using Capabilities.screenResolutionX (and Y) will open the app in the middle of the main screen as these properties only apply to the main screen.
From the AS 3.0 reference:
"This property does not update with a user's screen resolution and instead only indicates the resolution at the time Flash Player or an Adobe AIR application started. Also, the value only specifies the main monitor."
Good to know.