Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Through several hands-on tutorials, instructor Todd Perkins shows how to best build dynamic, streamlined sites using Flash CS3 Professional. Learn how to create custom keyboard shortcuts, apply advanced text techniques such as animating scrolling text with custom easing controls, and using advanced animation techniques. Flash CS3 Professional Beyond the Basics covers many challenging features, including adding complex interactivity to a Flash CS3 project and getting Flash content on a phone. Exercise files accompany the tutorials.
Now we'll take a look at placing code inside of movie clips, and how to communicate from those movie clips to other elements inside of your Flash movie. On the stage, let's double-click the robot to enter its timeline. On frame one, select the robot on the stage and note that it's an instance of mcRobotDancing. What we're going to do is make the dance2, where the robot does the robot move, and the dance 3, where the robot does the breakdancing move. We'll make the dance2 and dance3 animations play one time and then have the robot return to doing the original dance1 dance.
For that reason we don't need to nest any code inside of mcRobotDancing. So let's go to the frame 8 where the dance2 Frame Label is. Select the robot on the stage and note that it's an instance of mcRobotHinge. So we'll double-click the robot. Above the very top layer let's create a new layer called actions. In the actions layer, I'm going to select the last frame. I'm going to press F7 to create a blank keyframe, then Option+F9 on the Mac or F9 on the PC to open the Actions panel.
Now in this case, this movie clip is inside of the movie clip with the Instance Name robot_mc which is an instance of a movie clip called mcRobotAll. That's the movie clip instance that contains all the Frame Labels - dance1, dance2, dance3. So what we need to do here is have a way to communicate to robot_mc. Because this movie clip that we're working in is inside of robot_mc, it is considered a child of robot_mc.
In other words, the robot_mc movie clip is this movie clip's parents. So what we need to do, is we need to have a way to communicate to the parent movie clip from inside of this movie clip. So type var and then a space, and type thisParent. We're going to create a variable that represents this movie clip's parent movie clip. For the data type, type MovieClip and we'll set it equal to, and we're going to type Movie Clip, capital M and capital C, in some parentheses and inside the parentheses we're going to type this.parent In this case this refers to this movie clip, or this instance of mcRobotHinge.
Parent refers to this movie clip's parent movie clip, which is robot_mc. If we don't use this code that says movie clip in the parentheses, Flash will not automatically assume that the parent movie clip is in fact a movie clip. So we have to tell Flash to treat this movie clip's parent movie clip as a movie clip. If not Flash thinks of it as a datatype called the display object.
So we're telling Flash to create a variable called thisParent. It's a movie clip and it's equal to the parent movie clip of this movie clip as a movie clip. So let's go to the next line. And then type thisParent.gotoAndStop I'm going to type dance1 in quotes. Now what we'll do is select these two lines of code and then press Command+C on the Mac, or Ctrl+C on the PC to copy the code. We're going to paste the same code inside of the other robot dancing movie clip. So I'm going to close the Actions panel.
In the bottom of the timeline I'm going to go to the mcRobotAll movie clip. I'm going to select frame 15, the same frame as the dance3 frame. I'm going to double-click the robot on the stage. See that I'm inside mcRobotComplex. I'll create a new layer above all the other layers. I'll name the new layer actions. And then on the last frame of this animation, I'm going to select it and press F7 on my keyboard and then press Option+F9 to open the Actions panel, F9 on the PC. And inside of the Actions panel, I'm going to press Command+V or Ctrl+V on the PC, to paste the code that I just copied.
Now the dance2 and dance3 movie clips will play one time, and then once they're finished, The robot_mc movie clip will return to doing dance1. Let's test the movie using Command+Return on the Mac or Ctrl+Enter on the PC. So the robot's dancing during dance1. If you click dance2, the robot does the robot and then goes back to doing dance1. If you click the dance3 button, the robot does dance 3, then goes back to doing dance1.
And there's a look at nesting code inside of movie clips.
There are currently no FAQs about Flash CS3 Professional Beyond the Basics.
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.