How to Loop a Flash Movie Using Action Scripts
- 1). Open the source file for you Flash movie. Insert a layer for the additional script and name it "as."
- 2). Click the frame of the "as" layer where your loop will begin and press "F6" to create a keyframe if this frame is not already a keyframe. Open the "Actions" window by pressing "F9" and insert the following:
stop();
gotoAndPlay(1);
This causes the playhead to return to frame 1. It is more efficient to use labels because the animation can be modified, causing data to move to different frame numbers. Use Step 3 to create a new label. - 3). Click the frame for the new label and press "F6" to create a keyframe if necessary. In the "Properties" panel "Frame Label" field, insert a label name. For example, "begin." This name can now be used in your gotoAndPlay function as follows:
stop();
gotoAndPlay("begin"); - 4). Press "Ctrl" and "Enter" simultaneously to test your movie.