Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Controlling the playback of an animation is an important skill to have, and it goes without saying that it's sometimes necessary to control the Timelines of movie clips from within other objects. Let's take a look at the animation I have here. I'll test the movie, and you'll see the bear walks in, starts eating food out of the basket. This is an information video about how you shouldn't feed bears and how do put your food up on a rope in a tree to keep it away from a bear.
So, aside from looking a little bit sloppy, this animation could be a lot better. For example, we could change the camera angles and have the animation cropped, focusing on the most important parts. So this animation is a movie clip, and I have different keyframes in the Timeline that are scaled and move the movie clip to focus on key parts of the animation. If you don't have access to the exercise files, just create any animation inside of a movie clip and then set different keyframes upon the main Timeline with different views of that movie clip.
So what we are going to do is go inside of the movie clip and communicate back to the main Timeline, and give it cues as to when it should change scenes. So, let's go to frame 1 and double-click the movie clip. So here you can see the animation. Again, if you don't have exercise files, just create any simple animation. So, when the animation starts, we want it to have the normal view, in other words the full, panned-out view.
So, the bear walks in, and then the bear starts munching on some food. I've actually already created a keyframe in the actions layer here. So we'll put a command to go to the appropriate frame on the main Timeline. The appropriate frame, if we go to Scene 1, is going to be frame 20; that's this frame right here. You can see where the keyframe is. So, let's go back into the animation. So I'll go up to frame one on the main Timeline and double-click the movie clip.
Then I'll scroll to frame 103, click on the first keyframe of the actions layer, and open up the Actions panel. So, we want to send a command to the parent. I want to use gotoAndStop so the playhead on the main Timeline isn't skipping around in different views on its own. I want to control all of that from within this movie clip. So gotoAndStop at frame 20. The problem is the parent property, if you remember, gives us a display object container, which doesn't have a property called gotoAndStop.
So we are going to Flash to treat the parent as a movie clip. So wrap the word in a parenthesis. Before the parenthesis, type MovieClip, capital M, capital C all one word. So this code tells Flash to treat the parent as a movie clip, which it is, and to gotoAndStop at frame 20. So let's the movie and see this in action. So, when the bear gets to the basket, the angle should change. There we have it! So now all there is left to do is update each one of the different scenes appropriately.
So, let's go back to the main Timeline. So we have a view of just the basket at frame 41, and then it pans out a little bit at frame 71. So, let's go to frame 1, go back inside the movie clip, and continue on, previewing the animation. So, the bear is eating out of the basket. Then it shows the basket by itself. So, this is a good place to show the close-up view of the basket.
Let's select that keyframe of the actions layer, on frame 196, open up the Actions panel, and we'll type the same code. Since we know where we are going from the beginning, I'll type MovieClip to start out with, capital M, capital C, some parentheses, put parent inside of the parentheses to treat the parent as a MovieClip .gotoAndStop. Then we'll pass in the frame, that's going to be 41. So, you can test the movie again. The bear goes to the basket.
There is a close shot and then the shot of just the basket by itself, and then when the basket goes up, we want to zoom out all the way. So, let's scroll forward to frame 243. That's where the animation starts of the basket going up, and in that keyframe of the actions layer, we'll do the same thing: MovieClip(parent), after the parenthesis .gotoAndStop, pass in frame 1. That will give us the original shot from the beginning.
I am just going to select this line and copy it now, and we'll apply it one more time. Close the Actions panel and go forward, and the last part of the animation is the bear reaching for the basket. So select that keyframe of the actions layer, which is on the frame 329, and open up the Actions panel, paste the code that you copied - it's Ctrl+V or Command+V to paste - and then change the frame number to 71.
Test the movie, and you can preview the entire animation. So once the bear gets to the basket, you have a close-up shot, then a close-up shot showing the basket by itself, then the basket being pulled up into the tree, and the bear trying to reach the basket, but he can't. So with dot syntax and some simple built-in properties and methods, it's easy to control Timelines of movie clips, even if they are nested within other objects.
Using the typecasting technique by wrapping the parent code inside of a movie clip, you won't have any errors either.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 104331 Viewers
56 Video lessons · 116251 Viewers
71 Video lessons · 85469 Viewers
131 Video lessons · 40922 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.