# Scrubber problems

**URL:** <https://forum.kirupa.com/t/scrubber-problems/292130>\
**Category:** Uncategorized\
**Created:** [July 10, 2009, 12:23pm UTC](https://forum.kirupa.com/t/scrubber-problems/292130 "2009-07-10T12:23:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lukelol](https://avatars.discourse-cdn.com/v4/letter/l/5daacb/32.png) [@Lukelol](https://forum.kirupa.com/u/Lukelol)\
**Post date:** [July 10, 2009, 12:23pm UTC](https://forum.kirupa.com/t/scrubber-problems/292130/1 "2009-07-10T12:23:27Z")

</div>

Hey guys. I’ve been following the video/flv player tutorials on [gotoandlearn.com](http://gotoandlearn.com) but I’m having a bit of trouble with the scrub bar? Basically once I click on it and drag it to the desired location instead of “scrubbing” through the keyframes it pauses the video and once I let go, goes straight back to the beginning? Here’s the code I’m using:

//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(scrub,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);  
}

If anyone has any advice it would be much appreciated.  
I’m using Flash CS3 with AS 2 btw.

Thank you.
