Advertisement
Online Test Banks
Score higher
See Online Test Banks
eLearning
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

How to Use Goto Code with the Action Panel in Adobe Flash CS6

All ActionScript code in Adobe Flash CS6 is added to keyframes on the timeline, and here you’ll add some common ActionScript statements within the Code Editor and with the assistance of the Actions panel’s Script Assist mode.

image0.jpg

To loop a movie or to send the playhead to a different point on the Timeline, you can tell your movie to jump forward or backward to a specific frame with one of two variations of the goto statement: gotoAndPlay() and gotoAndStop().

Each of these two statements requires a frame name or number so that Flash Player knows where to send the playhead. When placed on a frame, these actions send the playhead forward or backward to the specified frame and stop, or they resume playback from that point.

To use gotoAndStop, follow these steps:

  1. On the Actions layer, select and create a new keyframe at frame 23.

  2. Choose Window→Actions to open the Actions panel.

  3. Click the plus sign and choose flash.display→MovieClip→Methods→gotoAndStop.

  4. In the Object field, target the current Timeline by typing this in the Object text box. Enter 1 in the Frame text box and make sure the Scene text box is empty.

    The statements should now read

    import flash.display.MovieClip;
    this.gotoAndStop(1);
  5. Choose Control→Test Movie to preview your movie.

    The tween plays and jumps to the first frame, where it stops.

Follow these steps to use gotoAndPlay():

  1. Create a new keyframe at frame 22 on the Actions layer and launch the Actions panel with the new keyframe selected.

  2. Click the plus sign and choose flash.display→MovieClip→Methods→gotoAndPlay.

    In the Object text box, have the timeline refer to itself by typing this.

  3. Enter 5 in the Frame text box and make sure the Scene text box is empty.

    The actions should now read

    image1.jpg
    import flash.display.MovieClip;
    this.gotoAndPlay(5);
  4. Choose Control→Test Movie to preview your movie.

    The animation plays until frame 22 and loops between frames 5 and 22.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win an iPad Mini. Enter to win now!