5 Replies Latest reply on Feb 6, 2008 5:21 AM by Newsgroup_User

    Progress Bar - Please HELP!

    markrecny1
      Listed is the code for my progress bar... I keep getting an error message when I go to test the movie, it reads...

      Error opening URL "file:///C|/Documents%20and%20Settings/Mark/Desktop/data05.swf"
      **Error** Symbol=preloader, layer=background, frame=1:Line 6: Syntax error.
      _parent.bytes = int(isloaded/1000) add " KB of " add int(total/1000) add " KB";

      **Error** Symbol=preloader, layer=background, frame=1:Line 7: Syntax error.
      _parent.percent = int(p) add "% LOADED";

      I don't know what I'm doing wrong... Any help is greatly appreciated! Also, my preloader used to go straight into the main movie and now when I test the entire movie it requires me to right click to "play" the movie. ?!?!?!?!
        • 1. Re: Progress Bar - Please HELP!
          rlc5611 Level 1
          Use + instead of add in Flash 8.
          • 2. Re: Progress Bar - Please HELP!
            markrecny1 Level 1
            WORKED PERFECTLY! Now, how do I get the rest of my movie to load after the progress bar?
            • 3. Re: Progress Bar - Please HELP!
              rlc5611 Level 1
              Well I admit I was curious about that. Your script is kind of like watching your grandparents being born. I think you need to redesign slightly what you are doing. If it were me, I would load a preloader SWF all by itself and then load the big SWF separately (maybe to a new level?) and let your preloader monitor the loading.
              • 4. Re: Progress Bar - Please HELP!
                markrecny1 Level 1
                Sounds like I need to go to school. What would be the easiest way to do this?! Any help is greatly appreciated! Thanks again!
                • 5. Re: Progress Bar - Please HELP!
                  Level 7
                  See Help for the MovieClipLoader class, this is the right way to do a
                  preloader. Never use those horrible on methods, like onClipEvent, those are
                  just bad and never necessary. Nutshell: make a new movie - a preloader -
                  make a new empty clip within it and give it an instance name of 'content'.
                  Put this code on frame 1, in a script layer:

                  var mcl = new MovieClipLoader();
                  var lis = new Object();

                  lis.onLoadInit = function(target:MovieClip){
                  //target (content) is now ready to do stuff with:
                  //target.activate();
                  }
                  lis.onLoadProgress = function(target:MovieClip, loadedBytes:Number,
                  totalBytes:Number){
                  //loaded / total * 100 is your loaded completion percentage
                  //use it to change a progress meter
                  }

                  mcl.addListener(lis);
                  mcl.loadClip("yourContentMovie.swf", content);

                  What I do is have all of my content movies have an activate() function, and
                  I call that within onLoadInit to 'start' the content. Maybe you want content
                  to fade in once it's loaded - give content an alpha of 0 within your loader
                  movie, and then within onLoadInit start a tween to fade it in, or simply set
                  it's alpha to 100, to have it appear once loaded. Lots of options.

                  HTH


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