• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Hour 14. Using ActionScript to Create No... > Task: Use a Frame Label as the Desti...

Task: Use a Frame Label as the Destination of a Go To

In the file created earlier, click frame 20 of the Animation layer. In the Properties panel you should see a place where you can type a frame label. Label this frame “Loop Start” (see Figure 14.5).

Figure 14.5. If we label frame 20 (via the Properties panel), the destination of our gotoAndPlay can change from a number (20) to a label name (“Loop Start”).

Go back and click on frame 30 in the Actions layer and open the Actions panel.

We're going to modify the gotoAndPlay line in the Frame Actions panel. Of course there's only one line, but to access the parameters for this line, we need to select it. Now, change the Type drop-down list to Frame Label. Then, select the Frame drop-down list and you should see all the labels available in the current Timeline. We've added only Loop Start, so that's all that's available—but you would see more if you had more. Select Loop Start from the drop-down list; this is more dependable than typing it and possibly adding a typo (see Figure 14.6). If you don't see the drop-down arrows to the right of your panel, resize the panel expanding outward until you do.

Figure 14.6. This new version of our gotoAndPlay is better because the destination is a frame label.

Test the movie; it doesn't look any different to the user. Now go back to the Timeline and click and drag the Loop Start keyframe to frame 10.

Test the movie again. The animation now loops back to frame 10, where you moved the Loop Start keyframe. The power of using a label as the destination of your gotoAndPlay is that you can now go back and move the location of the Loop Start keyframe to any frame you want and it still works!

Frame Actions

We just saw how placing one Action in a keyframe and changing its parameters makes the playback head jump to a different frame. But let's step back a second and consider what else we learned. Actions are instructions that we want Flash to follow. Actions do things. You can modify Actions by changing their parameters. All good information; however, if Actions are instructions, exactly when does Flash follow those instructions?



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint