Skip navigation
Currently Being Moderated

Exit button for .swf or projector?

Nov 4, 2011 2:31 PM

Tags: #as3 #swf #projector #exit #.swf

Hi All,

 

I am admittedly a complete novice, so please bear with...just completed Lynda tutorial on Flash Pro cs5.

 

Just trying to do a simple animation with an exit button to close out the player (projector, Flash Player). I have seen several discussions on the same, and have tried all example code to no avail. I am testing through publishing, not preview and it does not function as an exit button.

 

Have tried:

 

on(release){

fscommand("quit");

}

 

...and...

 

import flash.events.MouseEvent;

exitButton_mc
.addEventListener(MouseEvent.CLICK, function()
{
        fscommand
("quit");
}

 

 

I created the button symbol, selected it and then selected the first keyframe on that layer...entered AS3 window and tried the above code. No luck : /

 

Any help would be greatly appreciated! I searched through the forum and was unable to locate the answer to this question. Apologies if I missed it somehow.

 

Thanks in advance!!!

 
Replies
  • Peter Celuch
    505 posts
    Nov 17, 2005
    Currently Being Moderated
    Nov 4, 2011 3:33 PM   in reply to JS7

    I created an example which works just fine. You can download it here: http://dev.flashlabs.eu/examples/fscommand/source.zip

    The source looks like this:

     

    import flash.display.StageScaleMode;
     
    stage.scaleMode = StageScaleMode.NO_SCALE;
     
    btn_exit.addEventListener(MouseEvent.CLICK, exitBtn_clickHandler);
     
    function exitBtn_clickHandler(event:MouseEvent):void {
        fscommand("quit");
    }
    
     
    |
    Mark as:
  • Peter Celuch
    505 posts
    Nov 17, 2005
    Currently Being Moderated
    Nov 4, 2011 4:41 PM   in reply to JS7

    Sorry, I thought I saved it as CS4.. anyway, I uploaded a CS5 version now. Try downloading it again.

     
    |
    Mark as:
  • Peter Celuch
    505 posts
    Nov 17, 2005
    Currently Being Moderated
    Nov 4, 2011 5:19 PM   in reply to JS7

    You're wellcome.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 30, 2012 12:04 AM   in reply to Peter Celuch

    Hi,

     

    I want to know the swf can call fscommand too.

     

    I know projector file can call .bat/.exe but it is not working with swf in browser as well as standalone.

     

     

    Thanks

     
    |
    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