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.
This movie demonstrates more than just clip-to-clip communication. It also demonstrates how movie clip scripts and a movie clip's frame scripts can share a global variable. This global is available only inside the movie clip and not to other sibling movie clips or the main timeline.
|
|||||||||||||
Disclaimer
1) E-articles is not responsible for the information contained by this article as well for any and all copyright infringements by authors and writers. E-articles is a free information resource. If you suspect this article for any copyright infringement, please read the terms of service and contact us or use the "Report this article" button on this page to investigate the problem.
2) E-articles is not responsible for inaccuracies, falsehoods, or any other types of misinformation this article may contain and will not be liable for any loss or damage suffered by a user through the user's reliance on the information gained here. |
|||||||||||||