1 Reply Latest reply on Apr 8, 2009 8:02 AM by RossRitchey

    Loader Problem

      Dear Friend,

       

      I am Shabir Gilkar from Srinagar Kashmir working as web Designer in a IT company based in Srinagar Kashmir. I am fresher to the Flash and currently i am learning the Flash. I designed the Loader and Intro and the copy of which i am attaching with this post. Basically my loader is not working finely as per the requirements. Basically i have given the loader fluid filling effect, but at the 46-47% it goes full filled and then start again. Please take a look and suggest me the troubleshoot. Below given is the code i have written in the action script.

       

      stop();

       

      var yStart = 255;
      var yChange = 77;

       

      var myInterval = setInterval (preload,100);

       


      function preload () {
         
          var current = _root.getBytesLoaded();
          var total = _root.getBytesTotal();
         
          var pctload = Math.round(current/total*100);
         
           Pct_txt.text = pctload;
         
          Mask_mc._y = yStart - yChange/100*pctload;
         
          if (current >= total) {
             
              gotoAndStop ("Intro",1)
              clearInterval(myInterval);
              }
          }

       

      Regards

       

      Shabir Gilkar

        • 1. Re: Loader Problem
          RossRitchey Level 4

          Something funky seems to be going on with the formula.  My first guess is its an ordering issue.  The formula should probably look like:

          Mask_mc._y = yStart - (yChange/100)*pctload; - which will change the order the pieces are executed in.


          But that may not be absolutely correct anyways.

           

          An easier method, and the way I typically do this type of effect, is to make the text a MovieClip.  Use timeline animations inside that movieClip to animate the fill over 100 frames.  Put a stop() in the first frame.  And then, the code would look like:

           

          function preload () {
             
              var current = _root.getBytesLoaded();
              var total = _root.getBytesTotal();
             
              var pctload = Math.round(current/total*100);
             
              LoaderClip.gotoAndStop(pctload);
             
              if (current >= total) {
                 
                  gotoAndStop ("Intro",1)
                  clearInterval(myInterval);
                  }
              }

           

          So, the animation is flawless, because it is timeline-based, not code based.  No formulas to figure out, just find the percent, and send the animation to that frame.