Skip navigation
Currently Being Moderated

EXIT BUTTON Not Working

Feb 25, 2013 3:05 PM

Tags: #as3 #button #actionscript #game

Hi there...

I am pretty much a newbie working with Flash, so I would really appreciate any kind of help.

I have created a game, with lot of "brain burn" and getting help from the web, however, when I tried to put an exit button, even if I copied the AS3 code, it did not work.

 

This is what I Have

 

import flash.events.MouseEvent;

import flash.media.Sound;

import flash.system.fscommand;

 

fscorea_txt.text = score.toString();

playAgainButton.addEventListener(MouseEvent.CLICK, playAgain);

exitBtn.addEventListener(MouseEvent.MOUSE_DOWN, exitGame);

 

function exitGame(event:MouseEvent):void {

    fscommand("quit");

}

 

function playAgain(event:MouseEvent):void {

    playAgainButton.removeEventListener(MouseEvent.CLICK, playAgain);

    gotoAndStop(6);

}

 

I have also tried with MouseEvent.Click, exitGame but it did not work either, however, the other button works perfectly fine

 

Any help, please?

 

Thanks!!!!

 
Replies
  • Currently Being Moderated
    Feb 25, 2013 3:24 PM   in reply to SirMarley

    Unless you are working with Adobe AIR there is no way to "exit" your game with ActionScript. You might be able to have JavaScript unload your object from from the DOM.

     

    Another way you could do this, however, is have a button redirect the user to a different web page that does not have your .swf.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 25, 2013 3:32 PM   in reply to SirMarley

    Ah okay. With Adobe AIR try using:

     

    NativeApplication.nativeApplication.exit();

     

    instead.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points