View Full Version : Closing Flash Movie Automatically


Monkey Bizzle
02-22-2005, 06:40 AM
Is there a way to close a movie after it is done playing? For example, I want the viewer to click on a button called "Exit" and then when they do, an end animation will play and then when the animation is over, for the file to close. I am publishing in .exe if that makes any difference.

Sphere
02-22-2005, 04:27 PM
onClipEvent (enterFrame) {
getURL("javascript:window.close();");
}

this works in a browser, i don't know if it still works if its an executable.

EDIT:

i searched some for you on my local flash forum and found a solution:


onClipEvent (enterFrame) {
fscommand("quit");
}

This should work :)

Monkey Bizzle
02-22-2005, 06:53 PM
do i put that as an action on the last frame of the clip?

Monkey Bizzle
02-22-2005, 07:01 PM
well, i figured instead of waiting for an answer, i should just try it for myself to see if it works. Well, I get an error:

**Error** Scene=Scene 1 copy, layer=actions, frame=86:Line 1: Clip events are permitted only for movie clip instances
onClipEvent (enterFrame) {

Total ActionScript Errors: 1 Reported Errors: 1

Sphere
02-22-2005, 07:19 PM
ok i tested it this time. just enter this at the last frame:

fscommand("quit");

(i don't know flash and actionscript all out of my head so its always a bit testing for me also)

Marianne
02-22-2005, 07:19 PM
on your frame, just put:

fscommand("quit");

hehe you beat me to it, Sphere.
B.t.w., the error message you got, always means that an action that was meant to go on a movieclip was placed on a frame.
As you get more advanced at Flash, you're likely to see it a couple more times.

Monkey Bizzle
02-22-2005, 08:38 PM
yes, that works! Thank you!