anna
anna

Reputation: 2723

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.screenResolutionX;

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".

Upvotes: 0

Views: 2552

Answers (2)

anna
anna

Reputation: 2723

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);

Upvotes: 0

Florian F
Florian F

Reputation: 8875

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

Upvotes: 2

Related Questions