Stopping the Movie

I l @ ve RuBoard

Perhaps the simplest command in ActionScript is the stop command. When issued, it simply stops the movie in its tracks on the current frame.

Most of the time, you will want to place the stop command in a frame on the timeline. Although only stop is necessary, the Flash reference material shows the command with the optional parentheses, so we will use them here as well:

 stop (); 

When you use the stop command, the movie is really just paused on the current frame. Any animation inside movie clips or graphic symbols on the frame continues to animate. However, animation on the main timeline stops.

For the movie to continue, you need to issue another ActionScript command. The simplest one is the play command. This pushes the movie forward to the next frame, and it continues playing.

We'll look at the play command in the section, "Creating Buttons," later in this hour . For now, let's just look at an example of the stop command.

The movie stop.fla on the CD-ROM is a simple example. The first frame contains a large graphic of the letter "A" on it. The second and third frames contain the letters "B" and "C," respectively.

The second frame of the movie also contains a script. It is a simple script with just the stop command. Figure 5.1 shows the work area and timeline for this movie. Notice that there is an "a" in the second frame, signifying a script there. The Actions panel is also shown in Figure 5.1. In it, you can see the script.

Figure 5.1. The "a" indicates a script in frame 2 of the timeline.

graphics/05fig01.jpg

When you test the movie, the first frame with the "A" quickly appears. Then the movie moves on to the second frame with the "B." At this point, the stop command executes, and the movie stops on frame 2. Frame 3, with the "C" on it, never appears.

I l @ ve RuBoard


Sams Teach Yourself Flash MX ActionScript in 24 Hours
Sams Teach Yourself Flash MX ActionScript in 24 Hours
ISBN: 0672323850
EAN: 2147483647
Year: 2002
Pages: 272

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net