开发者

detect switch from adobe air app to another window

开发者 https://www.devze.com 2023-03-20 23:32 出处:网络
How can I determin开发者_开发知识库e if someone switch to another window (say notepad) while keeping air app open behind, I was looking for a way to detect if user switch form air app to another. Chec

How can I determin开发者_开发知识库e if someone switch to another window (say notepad) while keeping air app open behind, I was looking for a way to detect if user switch form air app to another.


Check out the activate and deactivate event handlers :

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx" 
    deactivate="deactivateHandler(event)" 
    activate="activateHandler(event)"
    >

<fx:Script>
    <![CDATA[
        import mx.controls.Alert;
        protected function deactivateHandler(event:Event):void
        {
            mx.controls.Alert.show('you left!');
        }

        protected function activateHandler(event:Event):void
        {
            mx.controls.Alert.show('you came back!');   
        }

    ]]>
</fx:Script>

<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

0

精彩评论

暂无评论...
验证码 换一张
取 消