5 Replies Latest reply on Feb 19, 2007 4:53 PM by

    probably a simple solution

      Ive searched numerous forums and links to try and create a preloader that uses the alpha to fade a movieclip in while loading. Here is what i have tried... (using Flash8)

      myLoaded = Math.round(getBytesLoaded());
      myTotal = Math.round(getBytesTotal());
      myPercent = myLoaded/myTotal;
      myBar._alpha = myPercent;
      myText = Math.round(myPercent*100)+"%";
      if (myLoaded == myTotal) {
      gotoAndStop(3);
      } else {
      gotoAndPlay(1);
      }

      Is there an obvious problem?

      Thanks
        • 1. Re: probably a simple solution
          Level 7
          _alpha takes a percentage as well, so you need to multiply your myPercent by
          100 _before_ setting alpha or your alpha is going to max out at 1

          --
          Dave -
          Head Developer
          www.blurredistinction.com
          Adobe Community Expert
          http://www.adobe.com/communities/experts/


          1 person found this helpful
          • 2. Re: probably a simple solution
            Thanks for the reply Dave...

            I now have this code. However, it still doesnt fade my movieclip.

            myLoaded = Math.round(getBytesLoaded());
            myTotal = Math.round(getBytesTotal());
            myPercent = myLoaded/myTotal*100;
            myBar._alpha = myPercent;
            myText = Math.round(myPercent*100)+"%";
            if (myLoaded == myTotal) {
            gotoAndStop(3);
            } else {
            gotoAndPlay(1);
            }

            I have myBar as a movieclip on a single frame. Do i need to tween this? Does the movieclip property need to be set to alpha %?

            thanks
            • 3. Re: probably a simple solution
              SymTsb Level 2
              hutts, i know this may sound stupid but are you actually testing downloads in flash to see if the animation is working or only uploading it and testing?
              1 person found this helpful
              • 4. Re: probably a simple solution
                Nothing sounds stupid to me anymore!!
                I am using the simulate download function...and have a large jpeg file on frame 3.
                I can see the movie uploading in the streaming window... the 'myBar' mc is displaying while uploading. However, it doesn't fade using the alpha command.?
                • 5. Re: probably a simple solution
                  I found the answer....the mc was spelt incorrectly!!!

                  Here was the final code if there is anyone out there interested...

                  myLoaded = Math.round(getBytesLoaded());
                  myTotal = Math.round(getBytesTotal());
                  myPercent = myLoaded/myTotal*100;
                  myBar._alpha = myPercent;
                  myText = Math.round(myPercent*100)+"%";
                  if (myLoaded == myTotal) {
                  gotoAndStop(3);
                  } else {
                  gotoAndPlay(1);
                  }