4 Replies Latest reply on Aug 13, 2009 3:39 AM by Sreelash

    Scrubber issue. AS 2, Flash CS 3

    lukeld

      Hey there. After following the scrubber tutorial on gotoandlearn I've hit a serious hick-up. Basically instead of scrubbing, if I grab and move my "scrub" it literally just pauses the video, and once I've let go, returns to the beginning?


      I've narrowed the problem down to the "scrubit" function and the script for that function but unfortunately can't seem to solve it. Any help out there?

       

      Here's the whole code:

       

      /*loadbar*/
      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 * 338;
          loader.scrub._x = ns.time / duration * 338;
      }

       

      var scrubInterval;

       

      loader.scrub.onPress = function()
      {
          clearInterval(videoInterval);
          scrubInterval = setInterval(scrubit,10);
          this.startDrag(false,0,this._y,336.6,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/336.6) * duration);
      }

       

      In bold is what I think the problem is.

       

      Any help, comments are much appreciated.

       

      Luke.