Stephen Horvath
Stephen Horvath

Reputation: 5588

How do I make an AIR NativeWindow always in front of just the app, but not in front of other windows?

I want the window to be always in front of all of the app windows, but when the app is deactivated I don't want the window to be in front of the other apps.

Upvotes: 2

Views: 1241

Answers (1)

Stephen Horvath
Stephen Horvath

Reputation: 5588

<mx:Window xmlns:mx="http://www.adobe.com/2006/mxml" alwaysInFront="true" initialize="onInitialize()">
<mx:Script>
    <![CDATA[
        private function onInitialize():void {
            addEventListener(Event.DEACTIVATE, onAppDeactivate);
            addEventListener(Event.ACTIVATE, onAppActivate);
        }

        private function onAppDeactivate(event:Event):void {
            alwaysInFront=false;
        }

        private function onAppActivate(event:Event):void {
            alwaysInFront=true;
        }
    ]]>
</mx:Script>
</mx:Window>

Upvotes: 3

Related Questions