I have a bunch of external SWF movies that I need to loop through, how can I do this. In other words I need each movie to play, movie1.swf, movie2.swf, etc. then once the last one in the group is done it starts over at movie1 again and just keeps doing it.
Well if you are loading the externals into a main via loadMovie then just load the next movie at the end of the previous movie’s animation. In other words, load the first external. At the end of the animation in that external use loadMovie(“external2.swf”) etc. On the last external reload the 1st external and you’ll be looping forever.
Yes, that would be the nice/easy way to handle it. But I don’t have access to the FLAs for the external SWFs so I have to write it in the code in the main movie.
That’s a bummer. Well I guess you could figure out how long each external swf plays for and then use setInterval in your main script. Kind of a pain but it will work with some trial and error.
Here’s what I ended up with. It works but I know theres got to be a better way to write it so I don’t have to write 15 different “if” loops. But, like I said, it works.
Thanks
dropZone1.loadMovie ("windows1.swf");
title_txt = "Windows - Appearance";
onEnterFrame = function () {
if (dropZone1._currentframe == dropZone1._totalframes - 1) {
dropZone1.unloadMovie ();
title_txt = "Windows - Start Menu";
dropZone2.loadMovie ("windows2.swf");
}
if (dropZone2._currentframe == dropZone2._totalframes - 1) {
dropZone2.unloadMovie ();
title_txt = "Windows - My Computer";
dropZone3.loadMovie ("windows3.swf");
}
if (dropZone3._currentframe == dropZone3._totalframes - 1) {
dropZone3.unloadMovie ();
title_txt = "Windows - My Documents";
dropZone4.loadMovie ("windows4.swf");
}
ETC.
dropZone1.loadMovie ("windows1.swf");
title_txt = "Windows - Appearance";
//
//This is the array that you'll need to put all of the title_txt values into.
myArray = new Array();
myArray[1] = "This is the title_txt value you'd like to be displayed when dropTarget1 reaches the end";
myArray[2] = "for dropTarget2";
myArray[3] = "etc...";
//
numberOfDropTargets = 5; //edit this so that it is equal to the number of droptargets in the dynamically loaded swf
//
onEnterFrame = function () {
for (i = 1; i <= numberOfDropTargets; i++);
if (this["dropTarget"+i]._currentframe == this["dropTarget"+i]._totalframes - 1) {
this["dropTarget"+i].unloadMovie();
title_txt = myArray*;
this["dropTarget"+(i+1)].loadMovie ("windows"+(i+1)+".swf";
}
}
}
I did this in notepad, so you may need to debug it slightly sorry for any inconvenienve caused.