7 Replies Latest reply on Mar 22, 2007 6:17 PM by kglad

    Action Script Problem

    Bauhaus99
      Trying to get just the front section of the site loaded using a preloader.
      When I went to test movie and you see just the preloader, you shouldn't see the preloader if the
      Action script is right unless you do a download simulation.

      Here is the script I have now. Needles to say it is not working correctly.

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

      }
      Did I mention my Action Script skills are B-A-D!
      Thank you in advance for any and all advice..........................
        • 1. Re: Action Script Problem
          kglad Adobe Community Professional & MVP
          is that code repeatedly executed? is the function FrameLoaded() defined?
          • 2. Re: Action Script Problem
            Bauhaus99 Level 1
            Not sure what your are asking. Treat me as if I know nothing.
            Below is the code that worked that I tried in vain to alter.

            myLoaded = Math.round(getBytesLoaded());
            myTotal = Math.round(getBytesTotal());
            myPercent = myLoaded/myTotal;
            myBar._width = myPercent*500;
            myText = Math.round(myPercent*100)+"%";
            if (myLoaded == myTotal) {
            gotoAndStop(3);
            } else {
            gotoAndPlay(1);
            }
            • 3. Re: Action Script Problem
              kglad Adobe Community Professional & MVP
              what are you trying to do by changing the code? are you trying to goto frame 3 when 3 frames are loaded? if so, use

              if(this._framesloaded>=3)

              instead of if(FrameLoaded(3))
              • 4. Re: Action Script Problem
                Bauhaus99 Level 1
                Thank you, this addition to the script helps the function.

                I'm trying to get this percent of my site loaded > myTotal = 285077;
                and at that point go to frame 3 .

                The number 285077, is used because that is the amount for frame 3 on the "Generate Size Report"
                The interesting thing that is happening is I must increase the number to 319700
                to get the Loader Bar to work properly, or it gives very odd readings of percentages.
                Any thoughts on why this is?[
                • 5. Re: Action Script Problem
                  kglad Adobe Community Professional & MVP
                  what percent do you want loaded or how many bytes do you want to load before advancing to frame 3?
                  • 6. Action Script Problem
                    Bauhaus99 Level 1
                    On the "Movie Report" for frame 3 it is ( 276513 Frame Bytes ) ( 285272 Total Bytes). for everything at that point to be loaded.

                    As I mentioned in my earlier post > "The interesting thing that is happening is I must increase the number to 319700
                    to get the Loader Bar to work properly, or it gives very odd readings of percentages.
                    Any thoughts on why this is?"

                    Here is the url to the tutorial that I picked this up from. The page 7 is where the problem is in the action script. > http://www.webwasp.co.uk/tutorials/b05-preload/07.php

                    And thanks again for your help it is most appreciated.
                    • 7. Re: Action Script Problem
                      kglad Adobe Community Professional & MVP
                      post a link to your fla.

                      and you don't need to explain why you want to do any particular thing. you just need to explain what you want.

                      so again, how many bytes do you want to load before advancing to frame 3. or do you just want to advance when frame 3 is loaded?