Welcome to Dream.In.Code
Click Here
Getting Help is Easy!

Join 118,589 Programmers for FREE! Ask your question and get quick answers from experts. There are 829 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Exiting an SWF with ActionScript

 
Reply to this topicStart new topic

Exiting an SWF with ActionScript

Mila
post 19 Jul, 2008 - 02:47 PM
Post #1


D.I.C Head

Group Icon
Joined: 28 Oct, 2006
Posts: 84



Dream Kudos: 25
My Contributions


So I'm making a stand-alone SWF that I want to exit when I press the escape button. I looked up some stuff online, and they all said to use fscommand("quit");, so I tried but it didn't work. Someone pointed out that it won't work in test applications, so I exported the thing, but it still doesn't work.

I have this in my code:

CODE

keylistener = new Object();
keylistener.onKeyDown = function() {
if (Key.getCode() == Key.ESCAPE)
        fscommand("quit");
}


Can anyone tell me where I'm going wrong?

Mila
User is offlineProfile CardPM

Go to the top of the page


JBrace1990
post 19 Jul, 2008 - 06:55 PM
Post #2


D.I.C Regular

Group Icon
Joined: 9 Mar, 2008
Posts: 460



Thanked 20 times

Dream Kudos: 350
My Contributions


I believe this would do it:

CODE
unloadMovieNum(0);
User is offlineProfile CardPM

Go to the top of the page

Mila
post 19 Jul, 2008 - 07:40 PM
Post #3


D.I.C Head

Group Icon
Joined: 28 Oct, 2006
Posts: 84



Dream Kudos: 25
My Contributions


I tried that like so:
CODE

keylistener = new Object();
keylistener.onKeyDown = function() {
if (Key.getCode() == Key.ESCAPE)
       unloadMovieNum(0);
};
Key.addListener(keylistener);


It didn't work. Unless this is improper syntax?
User is offlineProfile CardPM

Go to the top of the page

JBrace1990
post 22 Jul, 2008 - 12:31 PM
Post #4


D.I.C Regular

Group Icon
Joined: 9 Mar, 2008
Posts: 460



Thanked 20 times

Dream Kudos: 350
My Contributions


have you checked to see if the if statement works?
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/11/08 07:36PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month