- Stopping the Movie
- Jumping from Frame to Frame
- Creating Buttons
- Task: Slideshow
- Task: Simple Presentation
- Summary
- Q&A
- Workshop
Jumping from Frame to Frame
Another basic ActionScript command is the gotoAndPlay command that we have already seen many times in examples. This command jumps from the current frame to any frame you specify. You can use a number or a frame marker name. Here are some examples:
gotoAndPlay(7); gotoAndPlay(20); gotoAndPlay("my frame label")
You can also specify a scene if your movie uses more than one. If you use gotoAndPlay with just one parameter, that parameter is the frame. But if you use it with two parameters, the first is the scene name and the second is the frame number or name.
gotoAndPlay("My Scene","My Frame");
When you use the gotoAndPlay command, the movie jumps to the frame specified and immediately continues playing. However, if you want the movie to jump to another frame and stop on that frame, you should use the gotoAndStop command. It works the same way as gotoAndPlay, with the same option of using one or two parameters.
There are also two simple commands that work just like gotoAndStop but take the movie to the next frame or the previous frame. You can use nextFrame or prevFrame in cases where you just want to advance or go back one frame.
To see all these commands in action, it is useful to have a movie with buttons. So let's take a look at how to create buttons before going any further.