Jumping from Frame to Frame

by Milan Midovich.

Share
|
Homepage | Submit your article | Contact | TOS
More articles on flash  

You are here: Categories » Computers and technology » Flash

A 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.

Leave a comment or ask a question
Total comments: 0

Flash Disclaimer

  • The e-articles directory is not responsible for any and all copyright infringements by writers and authors. If you suspect the information contained by this page for any copyright infringements, please contact us to investigate the issue
ActionScript: Repeating an Operation Many Times - You want to perform a task multiple times within a single frame. Use a loop to perform the same task multiple times within a single frame. For example, you can use a for statement: (more...)
Avoiding Conflicting Variables in ActionScript - You want to make sure that variables within a function do not interfere with variables in other functions or within the timeline in which the function is defined. Use the var keyword to declare loc (more...)
How to Exit a Function in ActionScript - You want to exit a function. Functions terminate automatically after the last statement within the function executes. Use a return statement to exit a function before reaching its end. The (more...)
Move Clip Rotation - A property like _x and _y is the movie clip property _rotation. The _rotation property accepts a value in degrees. A circle is divided into 360 degrees. The values used by _rotation range f (more...)
Targeting Flash Movie Clips - The simplest way to target a movie clip is to use its name, followed by a dot, followed by the command you want to send. However, there are plenty of other ways to target a movie clip as we (more...)
Using Mathematical Operators in ActionScript - You want to modify something over time, such as the rotation or position of a movie clip. Use the compound assignment operators to change a variable or property in increments. Or, if increm (more...)
How to build an animated button using Flash - Time: 15 Minutes. Difficulty Level: Intermediate Requirements: Flash 8 Assumed Knowledge: Basic action (more...)
Enhancing Standalone Projector - You want to create an enhanced Standalone Projector with features such as borderless playback, custom titles, no Flash menus, and so on. Use a third-party tool such as SWF Studio or SWFKit to c (more...)
Creating Flash Buttons - Buttons are one of the three main types of symbols that you use in Flash. The others are movie clips and graphics. Making a New Button There are many ways to create a button. One (more...)
Bouncing Ball Script - Start a new Flash movie. Create a movie clip that has a ball graphic inside it. You can name the instance of the movie clip, myClip, but our code will not depend on the name of the clip. (more...)

 
free content
    Copyright © 2006 - 2012 e-articles.info.
The texts, articles and tutorials in the directory are property of their respective owners and authors.