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

exit button for ActionScript 3.0 class

Explorer ,
Mar 03, 2013 Mar 03, 2013

Hi

I want to exit my swf or exe file using the exit button, I try this code but its not working

package  {

 

                    import flash.display.SimpleButton;

                    import flash.display.MovieClip;

                    import flash.events.MouseEvent;

                    import flash.system.fscommand;

                    public class b_exit extends SimpleButton {

 

                    public function b_exit() {

                              this.addEventListener(MouseEvent.CLICK,clickF);

                              }

 

                    private function clickF(e:MouseEvent):void{

                              fscommand("quit");

                                        }

        }

}

TOPICS
ActionScript , Code , How to
17.0K
Translate
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 ,
Mar 03, 2013 Mar 03, 2013

I got the solution

package  {

                    import flash.display.SimpleButton;

                    import flash.display.MovieClip;

                    import flash.events.MouseEvent;

                    import flash.system.fscommand;

                    public class b_exit extends SimpleButton {

 

                    public function b_exit() {

                              this.addEventListener(MouseEvent.CLICK,clickF);

                              }

 

                    private function clickF(event:MouseEvent):void {

                              fscommand("quit");

                              }

        }

}

Translate
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
Community Beginner ,
Mar 03, 2013 Mar 03, 2013

This one work when you hit the back or home button:


import flash.system.Capabilities;

import flash.desktop.SystemIdleMode;



if (Capabilities.cpuArchitecture == "ARM")



{




NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, handleActivate, false, 0, true);




NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, handleDeactivate, false, 0, true);




NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys, false, 0, true);



}



//==================================================================


public function handleActivate(event:Event):void


{



NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;


}


//==================================================================


public function handleDeactivate(event:Event):void


{



NativeApplication.nativeApplication.exit();


}



//==================================================================


public function handleKeys(event:KeyboardEvent):void


{



if (event.keyCode == Keyboard.BACK)



{




NativeApplication.nativeApplication.exit();



}


}
Translate
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 ,
Jul 01, 2013 Jul 01, 2013

thx boss

Translate
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
New Here ,
Aug 08, 2018 Aug 08, 2018

Action script_ Exit button- quit pop- yes or no button not working in e learning !

Hi

in my  e learning offline  exit button working fine but once i uploaded to server that exit button not working. E learning completely created in action script and jss. can any one find the solution for this?

Translate
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
Community Expert ,
Aug 08, 2018 Aug 08, 2018
LATEST

Hi.

I think this will only work with stand-alone projector applications.

flash.system - Details Adobe ActionScript® 3 (AS3) API Reference

Maybe one of these answers is what you are looking for:

actionscript 3 - AS3.0 Quit the flash player - Stack Overflow

Close-Button inside swf File

Regards,

JC

Translate
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