2 Replies Latest reply on Oct 5, 2012 2:36 AM by subtlefly72

    How can I get a loading animation to play while fly playback component loads a file?

    subtlefly72 Level 1

      Hi team,

      Two part question here..

      So I have a FLV playback component and a number of .flv files that it loads   ------>  using video1.source="film/whatever.flv";

       

      There is a slight delay while the file loads and so I would like to

       

      A) make this pause a bit longer (it would be so fast at the moment that any loading animation would be subliminal, but with nothing at all you get a second of blank which is not good either- so if I can get it to be a bit longer, like say 2 seconds..

       

      B) have an animation play while this happens..

       

      It does not need to show progress or anything, just like a spinning wheel or whatever.

       

      I have been playing around with bufferTime but not really getting anywhere..

      Can anyone help me out?

       

      Thanks

      sub

        • 1. Re: How can I get a loading animation to play while fly playback component loads a file?
          subtlefly72 Level 1

          Here is a test with one flv player (video1) and two buttons (butt and butt1)

          Ok so I have some code that kind of works using the countdown timer... but I obviosuly dont know why it works because if I change the seconds count down from 1 to 2 it only works once.

          I get "working"

                   "working"  trace twice and it works

           

          After that I get the "working" trace but nothing happens    ...    I am close but would really like to understand a bit more what I am doing!

          Any help greatly appreciated.

          Cheers

          Sub

           

          import flash.events.MouseEvent;

          var fl_SecondsToCountDown:Number = 1;

          var fl_CountDownTimerInstance:Timer = new Timer(1000, fl_SecondsToCountDown);

           

          video1.visible=false;

          video1.load("film/film1.flv");

          video1.stop();


          butt.addEventListener(MouseEvent.CLICK, go);

          function go(e:MouseEvent){

                    video1.visible=false;

                    fl_SecondsToCountDown = 1;

          fl_CountDownTimerInstance.addEventListener(TimerEvent.TIMER, fl_CountDownTimerHandler);

          fl_CountDownTimerInstance.start();

              video1.load("film/film1.flv");

          }

          butt1.addEventListener(MouseEvent.CLICK, go1);

          function go1(e:MouseEvent){

                    video1.visible=false;

                    fl_SecondsToCountDown = 1;

          fl_CountDownTimerInstance.addEventListener(TimerEvent.TIMER, fl_CountDownTimerHandler);

          fl_CountDownTimerInstance.start();

                    video1.load("film/film2.flv");

          }

           

           

           

           

           

          function fl_CountDownTimerHandler(event:TimerEvent):void

          {trace("working");

                    fl_SecondsToCountDown--;

                    if(fl_SecondsToCountDown==0){

                              trace("done");

                              playmovie();

                              fl_CountDownTimerInstance.removeEventListener(TimerEvent.TIMER, fl_CountDownTimerHandler);

                    }

          }

          function playmovie(){

                    video1.visible=true;

                    video1.play();

          }

          • 2. Re: How can I get a loading animation to play while fly playback component loads a file?
            subtlefly72 Level 1

            Hi team I think I worked out my code here...

            I needed to use the "new" for each timer event to reset a new one each time..

            BUT even though this workaround kind of works, if anyone can actually give me some code that would hide a loading animation once a FLV player knows the film it is playing is loaded .. that would be golden.

             

            Cheers

            sub