• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

EXIT BUTTON Not Working

Explorer ,
Feb 25, 2013 Feb 25, 2013

Copy link to clipboard

Copied

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!!!!

TOPICS
ActionScript

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Feb 25, 2013 Feb 25, 2013

Ah okay. With Adobe AIR try using:

NativeApplication.nativeApplication.exit();

instead.

Votes

Translate

Translate
Engaged ,
Feb 25, 2013 Feb 25, 2013

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 25, 2013 Feb 25, 2013

Copy link to clipboard

Copied

Yes, I am working with Adobe Air, actually, it suppose to be a cell phone game, so I want the user to have the choice to play again or exit the game

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 25, 2013 Feb 25, 2013

Copy link to clipboard

Copied

Ah okay. With Adobe AIR try using:

NativeApplication.nativeApplication.exit();

instead.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 25, 2013 Feb 25, 2013

Copy link to clipboard

Copied

So, you mean this:

exitBtn.addEventListener(MouseEvent.MOUSE_DOWN, exitGame);

function exitGame(event:MouseEvent):void {

    NativeApplication.nativeApplication.exit();

}

?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 25, 2013 Feb 25, 2013

Copy link to clipboard

Copied

LATEST

It works perfectly.

Thanks a lot!!!!!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines