5 Replies Latest reply on Apr 11, 2008 8:41 AM by PaulatUnited

    Terminating an application

    PaulatUnited Level 1
      I am a NOOB in AIR. My first project is to convert an existing Flash program to AIR. I've got it all done except I am having trouble terminating the application.

      There is an EXIT button on the screen. When the user clicks it, a movie clip is displayed that asks if he/she is sure, with a Yes and a No button. When the Yes button is clicked, the movie clip is erased and the program should exit. When I try this in Flash with the debugger, the application disappears and I am back to the debugger which I then have to stop. When I compile and install the program on my hard drive, clicking the Yes button removes the movie clip but the application doesn't close. What am I missing???


      function ExitProg(event:Event):void {
      addChild(quit_mc);
      quit_mc.x=background.width/2;
      quit_mc.y=background.height/2;
      quit_mc.no_btn.addEventListener(MouseEvent.CLICK,noClick);
      quit_mc.yes_btn.addEventListener(MouseEvent.CLICK,yesClick);
      }
      function noClick(event:Event):void {
      removeChild(quit_mc);
      }
      function yesClick(event:Event):void {
      removeChild(quit_mc);
      nativeApplication.exit();
      }


      Paul D. Russell
      United Airlines