0 Replies Latest reply on Oct 2, 2007 1:45 PM by fourinchesofego

    preloading a series of images

    fourinchesofego
      Hello...

      I am attempting to preload a series of images to a mc [mostly just to get them into web-viewers' cache].

      This is the code I am using for the preload bit:

      function cigPreLoader() {
      var cigImage:Number = 1;
      var totalCigImages:Number = numOfCigPics;
      var cigImgToLoad:String = " http://www.fourinchesofego.com/cigs/cig"+cigImage+".jpg";
      var cig_mcl:MovieClipLoader = new MovieClipLoader();
      // Create listener object:
      var cigListener:Object = new Object();
      cigListener.onLoadComplete = function() {
      cigImage++;
      imagesLoaded++;
      if (cigImage<=totalCigImages) {
      cig_mcl.loadClip(cigImgToLoad, cig_mc);
      } else {
      alarmPreLoader();
      }
      };
      cig_mcl.addListener(cigListener);
      cig_mcl.loadClip(cigImgToLoad, cig_mc);
      }
      function alarmPreLoader() {
      var alarmImage:Number = 1;
      var totalAlarmImages:Number = numOfAlarmPics;
      var alarmImgToLoad:String = " http://www.fourinchesofego.com/alarms/alarm"+alarmImage+".jpg";
      var alarm_mcl:MovieClipLoader = new MovieClipLoader();
      // Create listener object:
      var alarmListener:Object = new Object();
      alarmListener.onLoadComplete = function(target_mc:MovieClip, status:Number):Void {
      imagesLoaded++;
      alarmImage++;
      if (alarmImage<totalAlarmImages) {
      alarm_mcl.loadClip(alarmImgToLoad, alarm_mc);
      } else {
      _root.gotoAndStop(2);
      }
      };
      alarm_mcl.addListener(alarmListener);
      alarm_mcl.loadClip(alarmImgToLoad, alarm_mc);
      }
      cigPreLoader();

      [the imagesLoaded++ is talking to a var that moves the preload graphic along]

      The problem is that this works just fine when I run the SWF locally; it nicely loads each image one after the other and then moves along to the actual piece. The problem is that when I jump over the run it online it just burns through without preloading each image.

      Any suggestions??

      You can see what is happening online at http://www.fourinchesofego.com/obviam.html

      Or you can grab the FLA at http://www.fourinchesofego.com/obviam.fla

      Thanks.

      Thanks.