2 Replies Latest reply on Sep 24, 2006 1:29 PM by LOCOOGGJSS

    Old Preloader

    sylar47
      I have an old preloader that looks like this:

      // skip to next scene when all frames are downloaded
      // else display the percentage value of getbytesloaded / getbytestotal in textfield 'downloaded'
      // and use the same value to jump to the corresponding frames in MovieClip download_bar.
      if (_root._framesloaded>=_root._totalframes) {
      gotoAndPlay("Games", 1);
      } else {
      downloaded = math.floor((_root.getbytesLoaded()/_root.getbytestotal())*100) add "%";
      download_bar.gotoandstop(downloaded);
      bytesloaded = math.floor(_root.getbytesloaded()/1000);
      bytestotal = math.floor(_root.getbytestotal()/1000);
      message = bytesloaded add "Kb of " add bytestotal add "Kb downloaded";
      }

      It doesn't work in flash 8. I get this error:

      **Error** Scene=Preloader, layer=Layer 2, frame=1:Line 7: Syntax error.
      downloaded = math.floor((_root.getbytesLoaded()/_root.getbytestotal())*100) add "%";

      **Error** Scene=Preloader, layer=Layer 2, frame=1:Line 11: Syntax error.
      message = bytesloaded add "Kb of " add bytestotal add "Kb downloaded";

      Total ActionScript Errors: 2 Reported Errors: 2

      Can anyone add any insight on what I need to change so it will function.

      Thanks!

      Jennifer
        • 1. Re: Old Preloader
          Rothrock Level 5
          I'm guessing you've skipped this directly from Flash 6 to Flash 8? Anyways capitalization counts now so you will need to change it to

          getBytesTotal() and getBytesLoaded()

          Also I think it is gotoAndStop();

          Also it is the Math class.

          But as you are using Flash 8 now I would recommend ditching this code and using the MovieClipLoader class. It has a nice little onLoadProgress event that you can use to control your preloader.
          • 2. Re: Old Preloader
            LOCOOGGJSS
            I'm hoping it's alright i borrow your topic, as my question relates to the same subject.

            Anyway, HI!
            My name is Sebastian.


            I would like some help with a preloader that i recently downloaded from a help site, and the preloader code is as followering:

            ifFrameLoaded ("Scene 2", 367) {
            gotoAndPlay(10);
            }


            The problem is that apparently this code goes onto the next scene, as soon as it picks up that your internet connection are quite fast. My scene two is a filesize of approx. 700kb. Not much, but running the film from the net on my dads computer, it's not fluent or as smooth as it should.

            That's why I would like help to create a source code that loads the entire film (mean while i created a small animation which is looping until it reaches frame 9 that says:

            gotoAndPlay(1);

            And then obviously the source code mentioned first is the one in command.


            So, could you please help me creating a source code that will load the ENTIRE movie, then fade my animation out (going to frame 10) and playing scene 2 (containing 367 frames..) as smooth as possible.


            Cheers!