Donate
 
Has KnowFlash helped you?

Donate towards running costs:


Why donate?

Newsletter
Sign up to our newsletter:
 
Enter your email address:
 
flash menu
Tutorials
Video Tutorials
Store
Main Menu
Home
News
Forum
Help/FAQ's
Contact Us
Search
Register
Advertise
Links
Webmasters

FSCommand - Quit Print E-mail
Written by Rawpulse   
Wednesday, 19 April 2006
Learn how to create a button which closes the projector
 
We're going to look at making our own quit button. These ae typically used for full screen presentations, or perhaps even games, to close the stadalone projector. To do this, we use the fscommand, which has many uses, but we're going to focus on the quit command. Obviously we're not going to create a huge slideshow or presentation for the sake of learning about the quit function, just some text that we can apply the command to.


Step 1

Start by using the text tool to write some text on your stage. In my example, I wrote "[close]". You might also want to use an X which usually signifies closing the window. Once you have drawn that on your stage, select it with the selection tool, then convert it to a symbol, by pressing F8. Select button from the behaviour list.





Step 2

Next we need to open the Actions panel. To do this, press F9. If you are using Flash 8, turn Script Assist on. Make sure the button is selected, not a frame. Now to add the fscommand, click the small blue cross to add an item to the script. Select Global Functions > Browser/Network > fscommand, or type escape + fs as a shortcut.





Step 3

If you have Script Assist* turned on, Flash will automatically add the "on (release)" event, because it knows you are applying the Actionscript to a button. The next thing to do is assign the quit command. To do this, click on line 2 of your code to edit it. There is a drop down selector to choose various commands for the standalone player. Select quit from the list.





You are now finished. You won't be able to work the close button by testing your movie the normal way (Control + Enter), so you will need to save the SWF file onto your computer, to test it. Click your text and the projector should close. There are other commands within the fscommand action, which we will look closer at in subsequent tutorials.


 *If you are using Flash MX or MX 2004, you won't have Script Assist. In which case, simply type out the code, as it is fairly short and basic. Alternatively, just copy and paste it into your ActionScript panel from beneath.

on (release) {
    fscommand("quit");
}

If you had a problem with this tutorial, tell us about it on the forum

Last Updated ( Wednesday, 19 April 2006 )
Next >

In association with Coursework Essays , Free Essays , Phishing Scams and Big Red Directory

Copyright Oxford Information Services Ltd 2007


Remote support
For a fixed monthly fee, our customers have unlimited access to our expert remote IT support as well as our on-site support service.