3 Replies Latest reply on Sep 21, 2009 12:11 PM by kglad

    PreLoad images

    AESS1981

      Hi, I have the following code to preload a set of images:

       

      pathToPics = "portfolio/2014/";

      var preLoader:MovieClip=this;

      var externalSWFs:Array=[pathToPics+"0.swf", pathToPics+"1.swf", pathToPics+"2.swf", pathToPics+"3.swf", pathToPics+"4.swf", pathToPics+"5.swf", pathToPics+"6.swf"];

      var loadTarget:Array = [preload0, preload1, preload2, preload3, preload4, preload5, preload6];

       

      var index:Number=0;

      loadNextSWF(index);

       

      function loadNextSWF(){

      if(index<externalSWFs.length){

      loadTarget[index].loadMovie(externalSWFs[index]);

      preLoader.onEnterFrame = preloadF;

      } else {

      delete preLoader.onEnterFrame;

      }

      }

       

      function preloadF(){

      var bl:Number=loadTarget[index].getBytesLoaded();

      var bt:Number=loadTarget[index].getBytesTotal();

      if(bl>0&&bl>=bt){

      preLoader["menu"+index].gotoAndPlay(1);

      index++;

      loadNextSWF();

      }

      }

       

       

      The swfs load perfectly in sequential order (ie. 0, 1, 2, 3, 4, 5, 6).

      The menu buttons ("menu"+index) are supposed to play in the same order as the swfs, but the order they play is:

      1 and 2 play at the same time, then 5, 6, 3, 4)

       

      The buttons are directly relevant to each image so the order is crucial.

       

      Is there a reason why this is happening?

      Thanks