2 Replies Latest reply on Jul 20, 2009 12:37 AM by dalcde

    Pause a flv in AS2

    deftones_sv

      Hi.

       

      I am designing a flv player... my problem right now is when I pause the video, and press play button again, the video starts from begining and I need it to play where it's paused.... my code:

       

      var cuenta:Number = 0;
      var total:String;
      var conexion:NetConnection = new NetConnection();
      conexion.connect(null);
      var stream:NetStream = new NetStream(conexion);
      mi_video.attachVideo(stream);
      //--
      function playVideo(pausa:Boolean) {
          if (pausa == false) {
              stream.play("motto.flv");
          }
          else{
              stream.pause()
          }
      }

       

      my buttons code:

       

      play_btn.onRelease = function() {
              playVideo(false);
      };

      pause_btn.onRelease = function() {
              playVideo(true);
      };

       

       

      Thank you

        • 1. Re: Pause a flv in AS2
          ocbfd Level 1

          Use play() only once to "load" a video.

           

          After that, use pause() to pause and un-pause the video.  First time you call pause(), the video pauses, second time you call pause(), it resumes playing.

           

          Here's an example pause function:

           

          function pressPlayPause(){
          trace("pressPlayPause()  videoPaused=" + videoPaused);
          if(videoPaused){
            videoPaused = false;
            videoNetStream.pause();
            pausePlayButton.gotoAndPlay("showPause");
          }else{
            videoPaused = true;
            videoNetStream.pause();
            pausePlayButton.gotoAndPlay("showPlay");
          }
          }

          • 2. Re: Pause a flv in AS2
            dalcde Level 1

            pausebutton.onRelease = function(){

            stream.stop()

            }

            playbutton.onRelease = function(){

            stream.play()

            }

             

            That code should work, if it is only a video without sound. If there is sound, I'm not sure.