4 Replies Latest reply on Feb 5, 2007 6:33 AM by Sketchsta

    Preload problem

    Vires_Infinitum
      The most common kind of preloader you encounter are the simple bar/percentage/byte preloaders which generally skip the loading animation as it really only takes up one frame.

      But it's the only kind of Preloader I've been able to find tutorials on, and my knowledge of Actionscript is lacking.

      I'm trying to create a preloader that not only has the little percentage indicator but has animation related to the main presentation playing as well. Specifically, every 10% of the presentation loaded I wish to animate an empty glass being placed on a table, complete with sound.

      The problem arises in that I don't know how to create a preloader that will go through the loading animation as normal, even if the load is complete.

      A simple example can be found in the Mario Brothers flash created by Phantasmagoria-crow
      http://www.newgrounds.com/portal/view/132378 - Warning: Website content may not be suitable for children, but it's the only place I could find it. The flash series is worth watching in itself, but notice that regardless of connection speed or even if you've just dragged the completed file out of your cache, the little squiggle still gets to dance.
        • 1. Re: Preload problem
          Sketchsta Level 1
          so you want just a loop to play until fully loaded???

          just make a movieclip, with a loop animation on it's timeline.....
          • 2. Preload problem
            shikozel Level 1
            follow this script

            //get the total bytes of you move
            total=_root.getBytesTotal()
            //onEnterFrame
            function onEnterFrame(){
            //first get how many bytes we loaded already
            loaded=_root.getBytesLoaded()
            //calculate how many precentage is it from the entire movie
            precentage=Math.floor(total/loaded)*100
            //check if this is multiply of 10
            if(precentage%10==0){
            //if it is multiply of 10
            //place empty glass clip
            }
            //if we loaded the netire movie
            if(precentage>=100){
            //delete the enter frame
            delete this.onEnterFrame
            //go and play you animation
            }
            • 3. Re: Preload problem
              Vires_Infinitum Level 1
              quote:

              Originally posted by: Sketchsta
              so you want just a loop to play until fully loaded???

              just make a movieclip, with a loop animation on it's timeline.....


              Sorry, should have been more specific. I don't want something to loop continuously while the flash is loading, I want a complex animation to play once, passing certain points as the load completes.

              And thanks, Shikozel - that looks to be about right.

              I think.
              • 4. Re: Preload problem
                Sketchsta Level 1
                ohh ok, i get you..

                well in that case heres the old code i used for preloading movieClips.

                basically its like this..
                progressBar is a movie clip which contains a 100 frame animation (which would be your complex animation )

                and the preLoader moves the playhead to frame that is equal to the persentage its loaded. which is why you use Math.Round to make the percent into a whole number..