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

Stop Action Print E-mail
Written by Rawpulse   
Saturday, 23 September 2006
Learn how to add a Stop action!
 

A Stop action is perhaps the most simple form of Actionscript you can add to your Flash project, but it's also a really effective one. This is essential if you're new to Flash, because you learn how to apply actions, but without needing to know lines of code.

Let's first see what a Stop action is. If you've ever made anything in Flash you'll know that when you test or publish your movie, the effect loops continuously. The way to stop it from repeating is by using a Stop action. This is the most basic use of the action. With it applied to your last keyframe, the movie will stop completely on that exact frame. You don't have to add it to the very last keyframe, you can put a Stop action anywhere on your timeline (on a keyframe), and the movie will stop playing at that point.

So how do you apply this action? Well, create a very simple animation on your stage, something like a square motion tweening from left to right. When you test your movie, you see that it goes to the right and then appears back on the left and does the tween again. That's because it reaches the last frame in your animation, and loops by default, starting again at frame 1. We will apply the action to the last keyframe. Select the keyframe, and press F9 to open your Actions panel. The panel will look different depending on what version of Flash you are using, and whether or not you have Script Assist turned on. Turn Script Assist off, if it is on.

The large white space is where you type in your code. The code for a Stop action is as follows:

stop();





That's it. Very simple. Type this into your Actions panel on the first line, and then close the panel. Now if you test your movie, it will stop on your last frame. You have successfully applied some Actionscript to your project.

There are other ways to add a Stop action to your project, though. Open the Actions panel again with the F9 key. Delete the "stop();" in the text area. Open the library of Actions, by clicking the small arrow button located on the left hand side of the Actions window. It may already be open by default.





Click the top book, entitled "Global Functions", then select "Timeline Control" from the sub menu. You will then see a variety of timeline actions which you can apply. Stop is one of them. Double click it and the stop(); action will be added to your text area.





You can also add a Stop action by pressing the shortcut Esc + S + T, after you have clicked on the text area. You can tell that the Actionscript has added if you see a small lowercase "a" on top of your keyframe.





if you have had trouble following this tutorial, tell us about it on the KnowFlash forum.



Last Updated ( Friday, 20 October 2006 )
< Prev   Next >

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

Copyright Oxford Information Services Ltd 2007


IT support
Connect.co.uk provides top-notch IT Support for small and medium-sized enterprises.