开发者

Back button unloads application after changes currentState of Android Application AIR

开发者 https://www.devze.com 2023-04-05 22:45 出处:网络
I am creating an application. At one view I have three states. If I changes state and than back button pressed it unloads the application.

I am creating an application. At one view I have three states. If I changes state and than back button pressed it unloads the application.

I am developing it in Adobe AIR.

any one have any idea how to fix it.

Thanks开发者_开发技巧


States are not views, they do not get stacked in the navigator. Back button will never go backward for your states. The back button will drop the view you push until it reach the view 0, then it'll exit the application. You can monitor what's going on with the back button by listening like this:

systemManager.stage.addEventListener(KeyboardEvent.KEY_UP, handleCustomDeviceKeyUpHandler,false,10000);

private function handleCustomDeviceKeyUpHandler(event:KeyboardEvent):void {
    trace("handleCustomDeviceKeyUpHandler()")
    var key:uint = event.keyCode;
    if (key == Keyboard.BACK) {
        event.preventDefault(); //Comment if you don't want to prevent.
    }
}
0

精彩评论

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