Flash 8 - Controlling external .swf's in an array

Hello Everyone,

I have created a flash file that loads external swf’s into a container clip. This I will call “main” it has this code on it to load the external .swf’s




var clips = ["section1.swf", "section2.swf", "section3.swf", "section4.swf", "section5.swf", "section6.swf"];
var n = 0;


loadSWF = function(){
if(container2.holder){
container2.holder.removeMovieClip();
}
var clip = new MovieClipLoader();
var clipCtrl = new Object();

clipCtrl.onLoadInit = function(mc){
// any pre control scripts can come here
}
var holder = container2.createEmptyMovieClip("holder", 1);
clip.addListener(clipCtrl);
clip.loadClip(clips[n], holder);
}


loadNext = function(){
n++;
loadSWF();
}


loadNext();


Another thing to note is each .swf needs to load the next .swf in the array so I have put this code at the end of each of the .swf’s
_level0.loadNext();

There are two problems I am having:

  1. In the “Main” flash file it doesn’t load “section1.swf” like I want it to, instead it skips to “section2.swf” so logically I thought if it is skipping the first .swf in the array I will create a dummy swf; “section0.swf” (this swf file is non-existent since it is being skipped over by my code. Can someone explain why this is?

  2. This may be a result of #1 but when I get to the end of “section3.swf” it fails to load “section4.swf” instead it goes back to “secton2.swf” ??? Does anyone have any ideas as to why this is? It should follow the order of the array, right??

If anyone can help me it would greatly appreciated. I am struggling with the figuring this out and it has to be done ASAP (typical, I know)

Thanks for any help you can offer in advance.

-Mpot

Everything is working fine until I get to the 4th section.