1 Reply Latest reply on Jul 18, 2011 12:22 AM by demetriusmcclain

    NetStream Video Scrubber issue

    demetriusmcclain Level 1

      This is dumbfounding to me.  I am trying to get the scrubber to scrub the video.  The scrubber moves but the video just start from the beginning rather than from the point the scrubber is dragged to.  The crazy part is the loader.scrub.x (the first bolded text) is suppose to be loader.scrub._x.  However the scrubber doesn't show.  Therefore I had to remove the underscore to get it to appear.  Can someone take a look at the code and let me know why this isn't working and explain why the scrubber won't appear unless I remove the underscore from the initial loader.scrub.x

       

       

      var nc:NetConnection = new NetConnection();
      nc.connect(null);

      var ns:NetStream = new NetStream(nc);

      theVideo.attachVideo(ns);

      ns.play("LOB2_0644_new.flv");

       

      stop_mc.onRelease = function(){
      playpause_mc.gotoAndStop("playing");
      ns.seek(0);
      ns.pause();
      }

       

      playpause_mc.onRelease = function(){
      ns.pause();
        if (this._currentframe == 1)
          {
              this.gotoAndStop("playing");
              movie_mc.play();
          }
          else
          {
              this.gotoAndStop("paused");
              movie_mc.stop();
          } // end else if
      } // End of the function

      var videoInterval = setInterval(videoStatus,100);
      var amountLoaded:Number;
      var duration:Number;

      ns["onMetaData"] = function(obj){
      duration = obj.duration;
      }

      function videoStatus(){
      amountLoaded = ns.bytesLoaded / ns.bytesTotal;
      loader.loadbar._width = amountLoaded * 424;
      loader.scrub.x = ns.time / duration * 424;
      }

      var scrubInterval;

      loader.scrub.onPress = function(){
      clearInterval(videoInterval);
      scrubInterval = setInterval(scrubit,10);
      this.startDrag(false,0,this._y,424,this._y);

       

      }

      loader.scrub.onRelease = loader.scrub.onReleaseOutside = function(){
      clearInterval(scrubInterval);
      videoInterval = setInterval(videoStatus,100);
      this.stopDrag();
      }

      function scrubit(){
      ns.seek(Math.floor((loader.scrub._x/424)*duration));
      }

      _root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
      vSound.attachAudio(ns);

      var so:Sound = new Sound(vSound);

      so.setVolume(100);