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:

  • bounds
  • colorDepth
  • mainScreen (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.