Skip to main content
March 19, 2015
Question

AS3 button

  • March 19, 2015
  • 1 reply
  • 339 views

I am trying to write a button that will close the application down upon click. My code is as follows:

Exit_mc.addEventListener(MouseEvent.CLICK, CloseApp);

function CloseApp(e:MouseEvent) {
    fscommand("quit");
}

The application runs with no errors but when I click on the button nothing happens. Can anybody help?

This topic has been closed for replies.

1 reply

robdillon
Participating Frequently
March 19, 2015

Did you include:

import flash.system.fscommand;

March 19, 2015

Oh sorry must not have pasted that part in, yeah I included that into my code, when the app has finished running it goes to the end screen where the user can click the button to exit. So far no luck with it

robdillon
Participating Frequently
March 20, 2015

Here's an extensive discussion of closing an app. actionscript 3 - How to create exit button in Flash application - Stack Overflow One of these suggestions should work for you.