3 Replies Latest reply on Jan 20, 2010 7:50 AM by kglad

    Preloader: frame 1 stop, on 100% goto frame 2 (AS2)

    fledermaus

      Hello all,

       

      at first, I thought I could manage this myself searching the forums about "preloader" but none of the solutions seem to work. I think it has to do with the fact that I'm using the FLVPlayer with an external file.

       

      What am I looking for?

       

      1. Well, the preload code for frame 1 that makes sure the external F4V (movie.f4v in the same dir) is loaded 100% before it jumps to frame 2 where the movie should start playing...

       

      2. If possible, a progress bar.

       

      I'll keep on trying but I'm afraid I need your help since I can't get it working...

       

      thanks all !

        • 1. Re: Preloader: frame 1 stop, on 100% goto frame 2 (AS2)
          kglad Adobe Community Professional & MVP

          use:

           

          stop()

          var lo:Object = new Object();
          lo.progress = function(eo:Object):Void {
          // use eo.bytesLoaded and eo.bytesTotal for your progress bar

          if(eo.bytesLoaded==eo.bytesTotal){

          gotoAndStop(2);

          }
          };
          flv.addEventListener("progress", lo);
          flv.load("yourvid.f4v");

          • 2. Re: Preloader: frame 1 stop, on 100% goto frame 2 (AS2)
            fledermaus Level 1

            wow that was fast. I'll try it out right away. You don't have the same code for AS3?

            I would love to compare them since I'm learning AS3 too !

             

            And the progressbar is just dragging the buffering bar component on it and giving it the same instance name, being... lo then?

             

            Thanks...

            • 3. Re: Preloader: frame 1 stop, on 100% goto frame 2 (AS2)
              kglad Adobe Community Professional & MVP

              for your progress bar you would using something like:

               


              stop()

              var lo:Object = new Object();
              lo.progress = function(eo:Object):Void {
              progressbar.fill._width = progressbar._width*eo.bytesLoaded/eo.bytesTotal;

              if(eo.bytesLoaded==eo.bytesTotal){

              gotoAndStop(2);

              }
              };
              flv.addEventListener("progress", lo);
              flv.load("yourvid.f4v");

               

              and in as3:

               

              import fl.video.VideoProgressEvent;

               

              flv.addEventListener(VideoProgressEvent.PROGRESS,progressF);

              flv.load("yourvideo.f4v");

               

              function progressF(e:VideoProgressEvent){

              progressbar.fill._width = progressbar._width*e.bytesLoaded/e.bytesTotal;

              if(e.bytesLoaded==e.bytesTotal){

              gotoAndStop(2);

              }

              }

              1 person found this helpful