Tweet

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 - The visibleBounds of 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>
Tagged with:
 

7 Responses to Detecting the number of screens on a users system in Adobe AIR

  1. Roy A Koch says:

    How do I know if adobe is installed and working properly?

    • Machiel Heinen says:

      sorry, but there is no way from flash/air to check if flash/air is correctly installed. Basicly, make a “hello world” app and run it to test or download a tested and working app from the adobe download section to test it out.

  2. Peter deHaan says:

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu sodales velit, eu tristique nunc. Praesent tellus orci, lobortis eget faucibus quis, suscipit a felis. Vivamus in consectetur lorem. Cras eget orci commodo, dignissim dolor a, laoreet dolor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas quis convallis elit. Sed ornare libero vitae ipsum gravida elementum eget mattis enim.

  3. fadsasdf says:

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu sodales velit, eu tristique nunc. Praesent tellus orci, lobortis eget faucibus quis, suscipit a felis. Vivamus in consectetur lorem. Cras eget orci commodo, dignissim dolor a, laoreet dolor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas quis convallis elit. Sed ornare libero vitae ipsum gravida elementum eget mattis enim.

  4. Peter deHaan says:

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu sodales velit, eu tristique nunc. Praesent tellus orci, lobortis eget faucibus quis, suscipit a felis. Vivamus in consectetur lorem. Cras eget orci commodo, dignissim dolor a, laoreet dolor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas quis convallis elit. Sed ornare libero vitae ipsum gravida elementum eget mattis enim.333

  5. foo bar 444 says:

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu sodales velit, eu tristique nunc. Praesent tellus orci, lobortis eget faucibus quis, suscipit a felis. Vivamus in consectetur lorem. Cras eget orci commodo, dignissim dolor a, laoreet dolor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas quis convallis elit. Sed ornare libero vitae ipsum gravida elementum eget mattis enim.444

  6. Peter deHaan says:

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eu sodales velit, eu tristique nunc. Praesent tellus orci, lobortis eget faucibus quis, suscipit a felis. Vivamus in consectetur lorem. Cras eget orci commodo, dignissim dolor a, laoreet dolor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas quis convallis elit. Sed ornare libero vitae ipsum gravida elementum eget mattis enim.555

Leave a Reply