How to position AIR window on a second monitor?
I'd like to open a window in my AIR/Flex application on a second monitor if it's available. Don't know how to go about it. Tried this:
mySecondWindow.x = Capabilities.screenResolutio开发者_JAVA百科nX;
But this only gets the size of the first monitor and if I try to assign a greater value, it switches to default 100px offset. Is there a proper approach to this? My native screen is maximized in "preinitialize" and then I open the second window on "applicationComplete".
You can use the static property Screens.screen that returns the screens on a user system.
Have a look at the Screen ASDoc for more info. If you need a sample of how to use it, have a look at this application source code
For whatever reason, directly assigning X and Y values to my second window never got it onto the second monitor. What finally worked was to use the "move" method to position the window.
var screen:Screen = Screen.screens[1];
mySecondWindow.move(screen.visibleBounds.left + 100, screen.visibleBounds.top + 100);
精彩评论