Detecting the number of screens on a users system in Adobe AIR
The following example shows how you can detect the number of screens on a user’s system in Adobe AIR by using the static, read-only Screen.screens property.
From the documentation:
colorDepth– The color depth of this screen (expressed in number of bits).visibleBounds– ThevisibleBoundsof a screen excludes the task bar (and other docked desk bars) on Windows, and excludes the menu bar and, depending on system settings, the dock on Mac OS X.
<?xml version="1.0" encoding="utf-8"?> <!-- http://airexamples.com/2010/03/15/detecting-the-number-of-screens-on-a-users-system-in-adobe-air/ --> <mx:WindowedApplication name="Screen_screens_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" initialize="init();"> <mx:Script> <![CDATA[ private function init():void { var tmp:Screen; txt.htmlText = "<b>You have " + Screen.screens.length + " screens:</b>\n"; for each (tmp in Screen.screens) { txt.htmlText += "<li>width:" + tmp.visibleBounds.width + ", height:" + tmp.visibleBounds.height + ", colorDepth:" + tmp.colorDepth + "</li>"; } } ]]> </mx:Script> <mx:Text id="txt" width="300" /> </mx:WindowedApplication>
