Tuesday 23 April 2013

New Problem

I found a problem which occurred at the exit part of the application. The application did not fully exit when I pressed the back button, and when I pressed back to the app, it displayed the previous page when I exit the application. Therefore, I found a script online and it worked well to solve the problem. I had tested this on my phone as well.


Script
if(Capabilities.cpuArchitecture==”ARM”){
NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, handleActivate, false, 0, true); NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, handleDeactivate, false, 0, true); NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys, false, 0, true);
}
function handleActivate(event:Event):void
{
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
}
function handleDeactivate(event:Event):void
{
NativeApplication.nativeApplication.exit();
}
function handleKeys(event:KeyboardEvent):void
{
if(event.keyCode == Keyboard.BACK) {
NativeApplication.nativeApplication.exit();
}
}

No comments:

Post a Comment