0

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.

2 Answers2

1

Try:

  • fscommand("quit")
  • NativeApplication.nativeApplication.exit() (AIR only)
  • System.exit() (Debug player only)
Simon Eyraud
  • 2,445
  • 1
  • 20
  • 22
  • NativeApplication.nativeApplication.exit() is the one to use for this situation. Realize that most mobile applications don't exit and rely on the OS to shut them down when it feels like it. In fact, on iOS there is no exitApp() function provided by the OS. – Joe Ward Oct 20 '11 at 16:38
  • Okay, figured out what I needed to import to get my project to recognize NativeApplication, its import flash.desktop.NativeApplication; No clue why I never came across that on any of the sites before, unless I just overlooked it. – Mistress phePhe Oct 22 '11 at 18:52
0
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.

Limitless isa
  • 3,689
  • 36
  • 28