簡體   English   中英

處理as3中的iOS主頁按鈕按下

[英]Handle iOS home button press in as3

我需要幫助檢測並處理運行AIR應用程序的iPhone / iPod Touch上的主頁按鈕。 我試過了

NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys, false, 0, true);

function handleKeys(event:KeyboardEvent):void
{
    if(event.keyCode == Keyboard.HOME) {
         //do something
    }
}

沒有運氣。 有任何想法嗎? 具體來說,我想防止在按下主頁按鈕時關閉應用程序。

import flash.events.Event;

addEventListener(Event.ACTIVATE, activateListener);
addEventListener(Event.DEACTIVATE, deactivateListener);

private function activateListener(e:Event):void{
        //do something when awakened

}


private function deactivateListener(e:Event):void{
        //do something when home button is pressed.

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM