1 Reply Latest reply on Apr 16, 2007 9:46 AM by "B"

    How to Make a Preloader Work?

    BSquared40
      Hi,

      I’ve successfully used a preloader that I built from a tutorial on the internet. In the movie where it is functioning correctly, all the actions are on the main timeline.

      But now I’m trying to use the same preloader for a movie where the main action, instead of being on the main timeline, is a movieclip of about 60 frames that is controlled by buttons on the main timeline. When I tried using the same preloader setup as I had used previously, it didn’t work. I’ve tried various changes, but my limited ActionScript knowledge isn’t up to the task.

      For the preloader in its original configuration, two layers are added to the main timeline, each having five frames. Five empty frames are added to each of the other layers, so that their starting points line up where the preloader layers’ frames end. The preloader layers are:

      Actions Layer: Five empty keyframes, with the code gotoAndPlay(1); in the fifth frame (so that the preloader loops until the loading is completed).

      Preloader Layer: The first five frames are keyframes that have the “Loading” message. The sixth frame is a keyframe labeled “start.” Following the sixth keyframe are a bunch of empty frames that span the length of the main timeline. At the end of this layer is a keyframe labeled “end.” The first keyframe of this layer has the code:

      ifFrameLoaded ("end") {
      gotoAndPlay ("start");
      }

      So, my question is, can I adapt the script so that it will work in a situation where the main action is not on the main timeline but is, instead, a movieclip? If so, how would the code or setup be changed to do that? Or is a completely different approach needed?

      Thanks!
      Bill
        • 1. Re: How to Make a Preloader Work?
          "B"
          I'm not sure if this will help...

          First, ifFrameLoaded is a deprecated function in favor of the _framesloaded property.

          Here's an example from the Flash help files:

          Frame 1 of the timeline is where you put your Preloader whether it's built statically or using ActionScript

          Frame 2 of the timeline is where you put the _framesloaded code....

          if (this._framesloaded < this._totalframes) {
          this.gotoAndPlay(1);
          } else {
          this.gotoAndStop(3);
          }



          Frame 3 is where you place your content and also a stop action on that frame too.

          Hopefully this will help.

          Brenda