« AIR is Desktop 2.0 | Main | Mapping File Extensions to MIME Types »
December 03, 2007
Multi-monitor Support in AIR
I've seen several people ask about multi-monitor support in AIR. The answer is: it's there, and it's very good.
Take a look at the flash.display.Screen class (AIR only -- not available in the Flash Player). It contains the following properties:
boundscolorDepthmainScreen(for getting a Screen reference to the main screen when there are multiple monitors)screens(an array of Screen objects for all attached monitors)visibleBounds(returns a Rectangle that excludes unusable portions of the screen like the taskbar, menu bar, and the dock)
The Screen class also contains a very cool function called getScreensForRectangle that returns an array of screens that intersect the specified Rectangle.
We've also added a ScreenMouseEvent that is dispatched by SystemTrayIcon and gives you the coordinates of a click relative to the main screen as opposed to an application window.
For a relatively simple example of the Screen APIs in action, check out SPF on the Adobe Labs Sample Application page.
Posted by cantrell at December 3, 2007 10:35 AM | References
Trackback Pings
TrackBack URL for this entry:
http://weblogs.macromedia.com/mtadmin/mt-tb.cgi/9166
Comments
Christian:
There is no sample app called "SPF" or any verbiage relating to multiple monitors on the labs link you provided. Help?
Mark
Posted by: Mark Mazelin at December 13, 2007 08:37 AM
The code is now available on Google Code here:
http://code.google.com/p/screenprotectionfactor/
Christian
Posted by: Christian Cantrell at December 18, 2007 07:35 AM
Any reason this isn't part of the Flash Player? Is there any possibility this will be part of Flash Player 10 ?
Posted by: arpit at January 18, 2008 05:28 PM
It's always possible that AIR APIs could find their way into the Flash Player, but I doubt the Screen APIs will be integrated anytime soon. They won't do much good since you can't do thinks like open new windows.
Christian
Posted by: Christian Cantrell at January 21, 2008 10:39 AM