1 Reply Latest reply on Feb 9, 2007 9:19 AM by Pop_Clingwrap

    Preloading Nightmares (kind of)

    melissa_v
      It's me again with my infinite questions. I have this code written to preload all of my .swf's in the background upon opening my site. Each of those swf files is a "loadMovieClip" function on various objects within the site.

      The code is:

      contArr = [
      "aboutPage.swf",
      "casestudiesSlideShow.swf",
      "homePage.swf",
      "introSlideShow.swf",
      "comingSoon.swf",
      "coveragePage.swf",
      "designPage.swf",
      "devastationSlideShow.swf",
      "facultyPage.swf",
      "partnersPage.swf",
      "progressPage.swf",
      "purchasePage.swf",
      "studentsPage.swf",
      "teamworkSlideShow.swf"
      ];

      function preloadClips (nr) {
      var cnt = this.createEmptyMovieClip("container",10);
      cnt._visible = false;
      var ch = this.createEmptyMovieClip("check",11);
      ch.onEnterFrame = function () {
      var bl = this._parent.container.getBytesLoaded();
      var bt = this._parent.container.getBytesTotal();
      if (bl/bt==1) {
      trace ("loaded" + contArr[nr]);
      this.removeMovieClip();
      this._parent.container.removeMovieClip();
      if (this.nr<=contArr.length) {
      preloadClips(++nr);
      } else {
      return;
      }
      }
      }
      cnt.loadMovie(contArr[nr]);
      }

      preloadClips(0);


      ___
      I am receiving this error message. All of the files are within the same folder, and I'm not really sure what file it is even looking for. Help??

      loadedaboutPage.swf
      loadedcasestudiesSlideShow.swf
      loadedhomePage.swf
      loadedintroSlideShow.swf
      loadedcomingSoon.swf
      loadedcoveragePage.swf
      loadeddesignPage.swf
      loadeddevastationSlideShow.swf
      loadedfacultyPage.swf
      loadedpartnersPage.swf
      loadedprogressPage.swf
      loadedpurchasePage.swf
      loadedstudentsPage.swf
      loadedteamworkSlideShow.swf
      Error opening URL "file:///C|/Documents%20and%20Settings/Melly/My%20Documents/School%20Documents/STUDIO/Web Site/undefined" Text
        • 1. Re: Preloading Nightmares (kind of)
          Pop_Clingwrap
          It looks like your container clip (cnt) is being created at the same level each time (10) so each new instance will replace the last one. This may not be THE problem but could be A problem (correct me if im wrong please).

          I would also recommend that you check out the MovieClipLoader Class (version permitting) as it is much more stable and means you don't have to write your own progress checkers etc.

          Sorry I cant be more help. Good luck