Automating Processes with Keyframe Loops
If you tried any of the above loops, you will have noticed that the movement of the movie clip, or the change in the clip’s alpha property, isn’t visible in the movie until the loop finishes. That is, you don’t see the gradual change in the properties. If you want the user to see each change as a property is updated, you need to use the onClipEvent(EnterFrame) or onEnterFrame() action to simulate a loop:
- Create a movie clip. Add a keyframe to the second frame.
- In the first frame, insert the actions that you want to loop.
- In the second frame, insert a gotoAndPlay(1) action to move the timeline back to the first frame. When the timeline returns to the first frame, the actions will be executed again, effectively creating a loop. You can add an if statement to either keyframe to test whether or a not a condition has been met to stop the loop and prevent the actions from continuing.
Macromedia Flash MX 2004 ActionScript 2.0 Tutorial and Free Online Training Course
In this section, you learned about:
- While Loops
- Do…While Loops
- For Loops
- For/In Loops
- Automating processes with Keyframe Loops