the source are from http://cartoonsmartblog.wordpress.com/2011/01/12/actionscript-3-code-for-quitting-an-android-app/
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