The following example shows how you can detect when an Adobe AIR WindowedApplication is activated or deactivated by listening for the activate and deactivate events.

Full code after the jump.

<?xml version="1.0" encoding="utf-8"?>
<!--  -->
<mx:WindowedApplication name="WindowedApplication_activate_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        activate="windowedApp_activate(event);"
        deactivate="windowedApp_deactivate(event);">
 
    <mx:Script>
        <![CDATA[
            private function windowedApp_activate(evt:Event):void {
                lbl.text = evt.type;
                lbl.setStyle("color", "haloGreen");
            }
 
            private function windowedApp_deactivate(evt:Event):void {
                lbl.text = evt.type;
                lbl.setStyle("color", "red");
            }
        ]]>
    </mx:Script>
 
    <mx:Label id="lbl" fontSize="72" />
 
</mx:WindowedApplication>
Tagged with:
 

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Spam Protection by WP-SpamFree