Jumping to Frames (Flash)

A single scene in flash can have many different objects/videos/images/etc. occurring in it. This is due to the essentially infinite length of the timeline.

To have interactively prompted actions on a single-scene timeline, the use of buttons and actionscript must be utilized.

Actionscript can be thought of as an indepedent programming canvas that does things to the objects on the stage or in the timeline. It is important to keep all actions on their own timeline layer for organization and clarity. The most important actionscript to learn/understand is the stop command.  It appears in the actions window as “stop();”

This freezes, or pauses the scene indefinitely, or until the user prompts an action. The below image shows my project after it reaches the first stop command.

For the project to continue the user must click on an established button. A button is an object that is converted to a symbol (button, graphic, and movie clip are the three types of symbols).

In this case, I used the repeated image of a red star for my buttons.

After converting the image to a symbol (button) be sure to name the “instance name,” which is a box in the properties window. I named my button “star1”

  • Now, to create an action, place the timeline cursor on the time period you want the action to be available (ideally the same location as the stop command), then click on the button (star1)
  • Next, go to window – code snippets.
  • Under “timeline navigation” choose the option “go to frame and play”
  • Automatically in the actions window the following code will appear.

  • Change the final parentheses number (5) to whatever frame you want the button to jump to (I chose 105)
  • Remember to move the stop(); command to after the new code that was just inserted.

Now when the user clicks the button star1, the time line will jump to the frame you commanded it to. Any objects/motions/etc you have at that frame will play upon the user’s click!



~ by johnmcala on April 16, 2011.

%d bloggers like this: