PDA

View Full Version : Looping Movies With Flash MX 2004



J_Paul
04-21-2004, 01:58 PM
It has come to my attention from working with Flash MX 2004 Professional that there isn't a quick way to loop a movie a certain amount of times without using action script. To find a better solution and a quick fix for a friend over the week I have come up with the following solution. While this is not the perfect solution to the problem it works and it works well.

When you create your movie be sure that your entire movie is in a " movie clip " on your main timeline. An easy way to do this is to draw a square on a blank frame in your main time line. Then highlight the square and hit F8. This will allow you to change the properties to make the square a movie clip. Now you can double click on your square and it will take you to the movie clip time line of the square.

Once you have created your animation count the number of frames in the movie clip. Take the number of frames in the movie clip, then double or triple it depending on how many times you want it to loop on the main time line and add that number of frames to the frame with the movie clip.

Now we are going to add an actions layer and add an extra frame beyond the last frame of the timeline with a stop action. You may need to add a layer to put anything that you want to have your movie stop with. Like the elements of the last frames of your animation.

I included 2 pictures to try to help explain the logic behind this tutorial .

Movie Clip Example

http://images.ientrymail.com/flashnewz/movieclip.gif

Main timeline example

http://images.ientrymail.com/flashnewz/mainframe.gif

Feel free to let me know if you have any questions on this method.

benihana
04-28-2004, 08:54 AM
hmm... whats wrong with doing it with actionscript though? what if you have to add another frame to the main movieclip, or want to change the number of loops? youd have to do some tweaking.

easy way:

first frame contains nothing except initialise a variable, say i:

i=0;

second frame onwards contains your movie as normal, and in the actionscript increments the value of i:

i++;

last frame of the movie checks if i has reached the amount of loops you want, say 8, and stops or goes back to frame 2:

if (i==8){
stop();
} else {
gotoAndPlay(2);
};

easy. if you want to change the amount of loops, just change the if (i=8) statement..

ben