如何在Android上检测解锁? (AIR App)

时间:2012-03-02 09:24:27

标签: android flash events air

我正在寻找一种解决方案,用于在设备处于空闲状态后检测用户何时解锁屏幕以恢复应用。我需要一个as3解决方案,因为我的应用程序正在运行AIR。

1 个答案:

答案 0 :(得分:0)

import flash.desktop.NativeApplication;

import flash.desktop.SystemIdleMode;

stage.addEventListener(Event.DEACTIVATE, onLeave);
stage.addEventListener(Event.ACTIVATE, onComeBack);


function onLeave(event:Event):void{
    SoundMixer.stopAll();
    stop();
    NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;
}


function onComeBack(event:Event):void{
    NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
    gotoAndPlay("1","Main");
}