Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Now that we've created Frame Labels we can use our buttons to navigate to those Frame Labels. Let's select frame 1 of the actions layer and open up the Actions panel by pressing Option+F9 on the Mac or F9 on the PC. At the top of your code find the dance1 function, mine goes from line 1 to line 4. Inside of that function at the end of the robot_mc.gotoAndStop line of code, delete the number inside the parentheses. Instead we're going to pass in a string, so type quotes. Inside the quotes, type the name of the Frame Label that you want to go to.
The name the Frame Label for the dance1 is dance1. Now we'll do the same thing for the dance2 function and the dance3 function. Select the number 2 inside of the dance2 function and replace that with the string value "dance2" In the dance3 function, replace the number 3 with the string value "dance3" So the difference between navigating to a frame number and a Frame Label, is that the Frame Label is a strings so you need to put the name of the Frame Label in quotes.
Let's test the movie and see this in action. Command+Return on the Mac, Ctrl+Enter on the PC. Click the buttons to navigate to the different Frame Labels, and then you can see the robot dancing. Let's close the Preview window. And now to really understand the beauty of Frame Labels, let's close the Actions panel and double-click the robot on the stage to enter its timeline. Inside of the robot's timeline I'm going move some Frame Labels. I'm going to first deselect everything by clicking on the stage, and then I'm going to drag from frame 10 of the labels layer down the frame 10 of the robot layer.
With both of those frames selected, I'm going to click those frames and drag them to move them to a different frame. Now let's test the movie to see if the code still works. Command+Return on the Mac, Ctrl+Enter on the PC. Click the dance2 button, and watch the robot do the robot. Let's close the Preview window. The thing that makes Frame Labels so great is as long as you move the label with the appropriate art, you never have to change your code. So I could move all of my Frame Labels as long as I move the appropriate art with the Frame Labels, I never have to change my ActionScript.
And there's at how to navigate through timelines using Frame Labels.
Get unlimited access to all courses for just $25/month.Become a member
58 Video lessons · 60264 Viewers
61 Video lessons · 92836 Viewers
82 Video lessons · 104231 Viewers
56 Video lessons · 107288 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.