Scrubber issue. AS 2, Flash CS 3
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.