3 Replies Latest reply on Sep 22, 2009 11:51 AM by kglad

    script being cancelled out by another action

    AESS1981 Level 1

      Hi,

       

      I am loading images 1 after the other using:

       

      var pathToPics = "portfolio/100_design/";

      var preLoader:MovieClip = this;

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

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


      var index:Number = 0;

      loadNextSWF(index);


      function loadNextSWF() {

      if (index<externalSWFs.length) {

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

      preLoader.onEnterFrame = preloadF;

      } else {

      menu_prev.gotoAndPlay(1);

      menu_next.gotoAndPlay(1);

      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();

      }

      }

       

       

      This works great, and the buttons 'menu1', 'menu2', 'menu3' ... become activated also.

      If one of these buttons are pressed before the loading sequence has finished, the sequence terminates and the images in the array stop loading.

       

      The button calls the following function:

       

      MovieClip.prototype.menuTwo = function(d) {

      pIndex = (pIndex=1)%pArray.length;

      onEnterFrame = fadeOut;

      };

       

      What I want to achieve is:

      When the button 'menu2' is pressed, the function 'menuTwo' is called, but the images in the array continue to load. Is this possible?

       

      I have unsuccessfully tried adding the following to function 'menuTwo':

       

      preloadF();

       

       

      Thanks again for your patience and efforts.