PDA

View Full Version : How do I make a presentation loop?


Imprezzy
10-06-2006, 12:47 AM
Hi! Currently, I've been hunting for information on creating a loop of 5-10 sec (60-120 frames) Flash movies I made. I made a bunch of 1024x768 Flash movies and I have about a dozen of them. What I want to do is to play all of those and after the last movie in the batch is played, I want it to loop again. It's for a motion graphics presentation shown on a computer monitor that's going to be looped for hours.

I've been searching this board for a definitive answer that suits what my project is and I haven't found a clear cut answer for my specific project or what I want to accomplish with this. What's the best approach for this? For some reason, a solution to something so darn simple has stumped me for days. The only thing I could figure out was installing Winamp and the PowerPlayer plugin to play a playlist of my .swf movies. Which is fine since the presentations are normally displayed on PC's.

If anyone can tell me a better method of doing this (besides copying and pasting frames from all the movies into one main file) through Actionscript by calling the next SWF after one ends and looping all the movies. Movie 1, movie 2, movie 3, movie 4, etc, etc, repeat again from movie 1. Copying and pasting frames will get pretty messy since some of the files are big enough to crash Flash on me. If I can get a good solution, that'll be great. Thanks in advance!

Here's the cliffnotes of the jumbled thoughts I just typed. LOL
1. I have a dozen .swf's
2. I want to play all of them back to back
3. It's a single file presentation and I want to loop that presentation by calling out each .swf.
4. I know it involves loading movie clips, but how?

I'll probably be burning these .swf's onto a CD to loop by itself, but let's get this first part settled before I ask about that. Again thanks in advance.

kennard
10-06-2006, 01:13 AM
clipsArray = ["1.swf", "2.swf", "3.swf"];
clipIndex = 0;
clipsTotal = clipsArray.length;
playCount = 0;
playTimes = 3;
createEmptyMovieClip("loader", 0);

loader.loadMovie(clipsArray[clipIndex]);
onEnterFrame = function () {
if (loader._currentframe == 1) {
//count that weve played through one clip once
playCount++;
if (playCount>=(playTimes + 1)) {
//enough of this movie, on to next clip
clipIndex++;
//make sure we go back to the start of all clips
if (clipIndex>=(clipsTotal)) {
clipIndex = 0;
}
playCount = 0;
loader.loadMovie(clipsArray[clipIndex]);
//loader._x = clipIndex * 60;
}
}
};

Sorry this is untested, you might need to tweak a bit or it might not work at all :)
Edit: Tested, edited and working

Imprezzy
10-06-2006, 09:57 PM
Hi! Thanks for your reply and your help. I got it to work for the most part. I actually have about 20 movies. Unfortunately it only works up to 19 movies. I had the arrays listed from "01.swf" to "20.swf" and set the playTime to 20. It works well for anything lower than 20 on the playCount and under 19 files listed on the clipsArray. I even tried placing 02.swf somewhere else on the list and the final movie in the array list ends up getting bumped off (or skipped) and looping back to the first one listed (01.swf). I tested each file to make sure it can loop to the next one by putting the file name as the first array and after that putting it in as the second array to make sure the presentation's able to advance to that file as well. Any help?

Edit: Correction, turns out I can only have 18 movies max. Any way I can increase the number of movies it can call before it loops again? =/

Imprezzy
10-06-2006, 11:35 PM
Nevermind, I goofed up somewhere while copying and pasting the new code you just edited to the old code. So I kept thinking that there was a limit on how many movies the code could play. Then I went back and tried the old code and realized that (clipsTotal - 1)) on the old code ended up skipping the last movie on the list at certain number of movies listed in the cilpsArray (I think after 3 it starts goofing up?). My fault was that I stopped testing after 3-4 movies (when the code worked fine, played the last movie I added to the list fine, and looped fine) and just kept adding the files.

So now the code works okay with this.

stop();
clipsArray = ["01.swf", "02.swf", "03.swf", "04.swf", "05.swf", "06.swf", "07.swf", "08.swf", "09.swf", "10.swf", "11.swf", "12.swf", "13.swf", "14.swf", "15.swf", "16.swf", "17.swf"];
clipIndex = 0;
clipsTotal = clipsArray.length;
playCount = 0;
playTimes = 17;
createEmptyMovieClip("loader", 0);

loader.loadMovie(clipsArray[clipIndex]);
onEnterFrame = function(){
if(loader._currentframe == loader._totalframes){
//count that weve played through one clip once
playCount++;

if(playCount >= playTimes){
//enough of this movie, on to next clip
clipIndex++;
//make sure we go back to the start of all clips
if(clipIndex >= (clipsTotal)){
clipIndex = 0;
}
playCount = 0;
loader.loadMovie(clipsArray[clipIndex]);
}
}
}

Anyhoo, back to work. Haha. Wew. At least after staring at that Actionscript all day, it started to make sense when I started tweaking it around, and I'm starting to get a gist of what I'm looking at.

Edit: BTW, at first I didn't have a stop(); tag at the end of my movies, so I took the liberty of adding one to each movie. When I didn't, one movie would loop over and over without ever advancing to the next one on the list.

kennard
10-07-2006, 04:56 AM
Sweet hope the presentation goes well.

Also, playTimes is how many times you want each single animation to play, it will automatically detect how many animations there are in total.

LAMF
10-11-2007, 11:59 AM
Great thread but it doesn't seem to work if I have embedded a .flv movie in the swf file.
It just skip the flv movie and goes on to the next swf file in line.

is there any way I can make it play the entire swf file with also the flv file embedded?
My swf file starts as a flash presentation and ends off with a flv movie.
My main purpose is simply to loop that swf file over and over. :eek: