Movie clips can also control other movie clips. By using the _root or _parent keyword, you can send your commands up one level. Then, by using the name of the movie clip you want to address, you can send the commands back down to another clip. Here is an example. Suppose that you want the movie clip “gears1″ to send a command to its sibling, “gears2″:

_parent.gears2.gotoAndStop(7);

If “gears1″ and “gears2″ are at level 1, _parent addresses level 0. Adding “gears2″ addresses the command back down to level 1, but to another movie clip entirely. Another way to do this would be with square brackets:

_parent["gears2"].gotoAndStop(7);

Now let’s use that technique to create a movie with three movie clips. The first one has a movie clip script that advances it one frame at a time. Inside this movie clip is a script triggered on the 15th frame. It tells the next movie clip to move forward one frame. This second movie clip does the same thing to a third movie clip. The result is that the first movie clip animates quickly, one frame per normal movie frame. The second movie clip animates one frame for every 15 frames that the first clip animates. The third movie clip animates one frame for every 15 frames the second clip animates.

Taken From: Sams Teach Yourself Flashâ„¢ MX ActionScript in 24 Hours

Leave a Reply