Preloading External Swfs one by one

[CS3 AS2]

Hello all :slight_smile:

I seem to have a bit of a problem, ive tryed a bunch of different ways and tutorials to fix it but dont seem to be going anywere.

Im trying to make a banner controller swf that will allow me using an xml list to pre-load external swf banners into the controller swf.

The first banner that loads needs a preloader, and then the rest of the banners need to be loading while the first one is playing. Once this first banner is complete, IF the next banner has loaded, it should start playing the next banner, and so on through the xml list.

I have managed to get the xml looping through the banners, but the loading still seems to be loading everything at the start.

Unfortunatly im not allowed to link the banners that will be loading into the controller, but at the moment, the last frame of the external banners have a call to the loadNextBanner() function you will see below.

Here is what ive got so far - Not 100% sure if im even going in the correct direction here, any help would be greatly appreciated :

var previousBanner:Number = 0;
var currentBanner:Number = 0;
var currentDepth:Number = 100;
var firstLoad = true;
var myXML:XML = new XML();
myXML.ignoreWhite = true;
var banners:Array = new Array();
myXML.load("banners.xml");
myXML.onLoad = function() {
 var bannerName:Array = this.firstChild.childNodes;
 var totalBanners:Number = bannerName.length;
 _root.trueTotalBanners = totalBanners;
 for (i=0; i<bannerName.length; i++) {
  banners.push(bannerName*.attributes.LINK);
  currentBannerName = bannerName*.attributes.LINK;
  _root["vid"+i] = _root.createEmptyMovieClip("vidHolder"+i, currentDepth);
  trace(currentDepth);
  currentDepth++;
  _root["myLoader"+i] = new MovieClipLoader();
  _root["myListener"+i] = new Object();
  _root["myListener"+i].onLoadInit = function() {
   nextBannerLoaded = true;
   loadNextBanner();
   firstLoad = false;
  };
  _root["myLoader"+i].addListener(_root["myListener"+i]);
  _root["myLoader"+i].loadClip(currentBannerName,_root["vid"+i]);
 }
};
function loadNextBanner() {
 previousBanner = currentBanner;
 currentBanner++;
 
 if (nextBannerLoaded == true) {
  if (currentBanner == trueTotalBanners) {
   currentBanner = 0;
  }
  _root["vidHolder"+previousBanner].gotoAndStop(1);
  _root["vidHolder"+currentBanner].swapDepths(200);
  _root["vidHolder"+currentBanner]._visible = true;
  _root["vidHolder"+currentBanner].play();
  trace("previous banner = "+_root["vidHolder"+previousBanner]);
 }
}

XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<NAVBAR>
   <BUTTON LINK='homebanner_1.swf'></BUTTON>
   <BUTTON LINK='homebanner_2.swf'></BUTTON>
</NAVBAR>