Skip to content
Dec 25 /

Detecting the current system chrome setting in an Adobe AIR application

The following example show show you can detect the current system chrome setting in an Adobe AIR application by using the read-only systemChrome property and the static constants in the NativeWindowSystemChrome class.

Full code after the jump.

<?xml version="1.0" encoding="utf-8"?>
<!-- http://airexamples.com/2008/12/25/detecting-the-current-system-chrome-setting-in-an-adobe-air-application/ -->
<mx:WindowedApplication name="WindowedApplication_systemChrome_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();">
 
    <mx:Script>
        <![CDATA[
            import flash.display.NativeWindowSystemChrome;
 
            private function init():void {
                lbl.text = application.systemChrome;
                switch (application.systemChrome) {
                    case NativeWindowSystemChrome.ALTERNATE:
                        lbl2.text = "Specifies that the window should display the alternate chrome style (on systems that support alternate chrome). To detect whether a host system supports alternate chrome, use NativeWindowCapabilities.hasAlternateSystemChrome.";
                        break;
                    case NativeWindowSystemChrome.NONE:
                        lbl2.text = "No system chrome.";
                        break;
                    case NativeWindowSystemChrome.STANDARD:
                        lbl2.text = "The standard chrome for the host operating system.\nUse this setting to emulate the look and feel of the native operating system.";
                        break;
                    default:
                        lbl2.text = "Don't look at me, I'm hideous!";
                        break;
                }
            }
        ]]>
    </mx:Script>
 
    <mx:VBox>
        <mx:Label id="lbl" fontSize="72" />
        <mx:Text id="lbl2" width="100%" />
    </mx:VBox>
 
</mx:WindowedApplication>

To set the system chrome in an Adobe AIR application, edit the application’s XML file:

<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
<systemChrome>none</systemChrome>

Leave a Comment

Spam Protection by WP-SpamFree