Question

I have a project that was written using ACtionScript 3 in the Flash Builder Burrito preview IDE, with Adobe AIR 2.5 SDK. The way I was closing down the application was with....

stage.nativeWindow.close();

Now I've taken this same project and I'm using Adobe Flash Builder 4.5 for PHP with the Adobe AIR 2.6 SDK and I've turned it into an ActionScript Mobile Project and this line no longer works when running on an Android device because the nativeWindow never gets set, it's null. I've tried researching online how to replace this line of code and all I have been able to find is code for closing it down if I deploy it on iOS, which I'm not as of right now, or how to close it down if it's a projector project, or the stage.nativeWindow.close().

Everything else on the game runs fine, besides images loading slowly now, but that's a different issue. So any help with how to get my project to exit when the user hits my exit button would be greatly appreciated.

Was it helpful?

Solution

Try:

  • fscommand("quit")
  • NativeApplication.nativeApplication.exit() (AIR only)
  • System.exit() (Debug player only)

OTHER TIPS

import flash.desktop.NativeApplication;
closeBtn.buttonMode=true;
closeBtn.addEventListener(MouseEvent.CLICK, closeHandler);
function closeHandler(e:MouseEvent):void
{
    NativeApplication.nativeApplication.exit();
}

//Adobe Flash air for android close button code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top