10 Replies Latest reply on Mar 23, 2008 1:20 PM by cdeatherage

    Help with Progress Bar

    cdeatherage Level 3
      Hi, All . . .

      I'm about at my wits end. I created a slide show that I did not at first expect would need a "Loading" progress bar. Now that we're in the testing phase, there is enough of a lag to warrant one. I have utilized the Help files, consulted a couple of books I have, searched through past posts on this forum, and googled the topic for for direction. I have, at this point, tried many different methods--too numerous to recount or remember right now--that have not worked. I don't think I mis-copied any of the various coding I've tried, and I don't know if there were steps omitted in the coding that I did not pick up on. So, I'm here to ask if anyone can help guide me through the process.


        • 1. Re: Help with Progress Bar
          I'm with you on progress bars, but they are a necessary evil.

          from my understanding you need to use a loadVar to load the image and then ad a listener to the loadVar that will update the progress bar.

          I have made all my progress bars from the help files so you should be able to find it there.

          I know this is not very specific but you didn't get specific in your question.
          • 2. Re: Help with Progress Bar
            cdeatherage Level 3
            Thanks for the moral support. You're right. I wasn't very specific, more of a general rant. I started off using the F1 help files to create it. I followed, or so I thought, each step from adding a pre-loader and then the progress bar component. When I tested the action, the progress bar did not display. I can't recall the specific failure at that juncture because I tried several other methods, each of which failed for different reasons, and the many failures are now all one big blob in my mind.

            • 3. Re: Help with Progress Bar
              Level 7
              What's the problem anyway? If you use the MovieClipLoader class a progress
              bar is very easy. Using MCL you have the onProgress method that is called as
              the clip/image is downloading and you simply set the _xscale of a bar clip
              to the percentage downloaded.

              Dave -
              Head Developer
              Adobe Community Expert

              • 4. Re: Help with Progress Bar
                cdeatherage Level 3
                The problem is every iteration of code I try does not display a progress bar. I started out creating my files with the Flash slideshow template. It wasn't until recently that I realized I needed the progress bar. I have attempted several different code scenarios, but principally the Flash 8 F1 procedures for "Creating an application with the ProgrssBar component.

                I tried the component in event mode. Bar did not display. After reading Dave's reply, I tried the manual mode in example 3. It still does not display. (I also tried the first manual mode example, but it just made my Flash player run so slow I had to abort.)

                Here is the ActionScript attached only to one of the four files for which I need the progress bar:

                var img_mcl:MovieClipLoader = new MovieClipLoader();
                var mclListener:Object = new Object();
                mclListener.onLoadProgress = function(target_mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number) {
                my_pb.setProgress(numBytesLoaded, numBytesTotal);
                mclListener.onLoadComplete = function(target_mc:MovieClip) {
                my_pb._visible = false;
                this.createEmptyMovieClip("image_mc", 20);
                img_mcl.loadClip(" http://www.ivonnefrowein.com/test/flash/advertising.swf", image_swf);

                There's got to be an easy answer here, but I keep going around in circles.


                • 5. Re: Help with Progress Bar
                  rlc5611 Level 1
                  If you are using Flash Screens, are you aware that EVERYTHING is on the first and only frame in the SWF? Sounds like you need a stub movie.
                  • 6. Re: Help with Progress Bar
                    jessem1985 Level 1
                    // 1. put this code on first frame

                    preloader.preloader_bar._xscale = 0;
                    preloader._visible = false;

                    function startMovie() {
                    if ((getBytesLoaded() == getBytesTotal())) {
                    preloader._visible = false;
                    } else {

                    assessLoad = function (Clip, endPreLoad) {
                    var kbLoaded:Number = Clip.getBytesLoaded()/1024;
                    var kbTotal:Number = Clip.getBytesTotal()/1024;
                    var percent:Number = Math.floor(kbLoaded/kbTotal*100);
                    preloader.preloader_bar._xscale = percent;
                    preloader.pct_loaded.htmlText = percent;
                    if ((kbLoaded/kbTotal == 1) && kbLoaded>1) {

                    endPreload = function () {

                    function startLoad(Clip) {
                    preload = setInterval(assessLoad, 100, Clip, endPreload);
                    preloader._visible = true;
                    preloader.preloader_bar._xscale = 0;


                    // 2. label frame 2 "start"
                    // 3. draw out bar - turn into MC - give instance name of "preloader_bar"
                    // 4. draw out dynamic text box - give instance name of "pct_loaded"
                    // 5. select MC and text box - create MC of both - give instance name of "preloader"

                    that should work.
                    • 7. Re: Help with Progress Bar
                      jessem1985 Level 1
                      oh and put the "preloader" on anywhere on frame 1 - any layer.
                      • 8. Re: Help with Progress Bar
                        jessem1985 Level 1
                        oh sorry...you must drag your whole movie over one frame to make room for the code and preloader. just think of your movie starting on frame 2.
                        • 9. Re: Help with Progress Bar
                          rlc5611 Level 1
                          If the poster is using screens, there is no frame 2. Doesn't exist.
                          • 10. Re: Help with Progress Bar
                            cdeatherage Level 3
                            To each of you who replied to my post . . .

                            Many thanks. I finally have the code worked out. I really appreciate your taking the time to help. It means a lot.