Specifications
Writing simple actions 59
Writing simple actions
You need to add some simple ActionScript to your banner in order for the 
invisible button to open a website or send information about how many 
clicks the banner has received.
There are several different places you can add ActionScript in a Flash 
document. You can select an instance, and add ActionScript that attaches 
directly to that instance. To access the code, you would need to find and 
select that instance again. You can also add ActionScript to a frame (or 
multiple frames) on the Timeline. It's a good idea to add all of your code to 
a single frame on the Timeline, because it's much easier to find, update, 
and organize when you're working on a file. Do not attach your 
ActionScript to instances. 
Notice how your Join Us motion tween continually loops when you test it. 
By default, the playhead on the Timeline loops if you have content on 
more than one frame. Therefore, if you have content on several frames in a 
movie clip or on the main Timeline, it will play and loop forever. You can 
stop the playhead from looping by adding a single line of ActionScript. If 
you add this ActionScript to a frame, the playhead stops when it reaches 
that frame:
stop();
You don't need to add this ActionScript to your banner. However, you will 
need to add this ActionScript to other FLA files that you create. The stop 
action is ActionScript you need to know about when you start using Flash 
so you can stop looping SWF files when necessary. 
NOTE
 You can also keep your ActionScript in external class files that import into 
the FLA file you're working on. This is sometimes the best way to organize 
your ActionScript, particularly when you work on larger projects. This 
topic goes beyond the scope of this tutorial.










