If it's not too late and if you don't mind, I'd like to leave a suggestion.
var that = this;
this.button = this.slider.button;
this.bar = this.slider.bar;
this.buttonWidth = this.button.nominalBounds.width;
this.barWidth = this.bar.nominalBounds.width;
this.speedX = 0;
this.friction = 0.95;
this.isDragging = false;
this.bar.on("mousedown", function(evt)
{
that.anim.stop();
that.clickedX = stage.mouseX - that.slider.x;
that.button.x = that.clickedX;
that.isDragging = true;
});
stage.on("stagemouseup", function(e)
{
that.isDragging = false;
that.anim.play();
});
createjs.Ticker.on("tick", function(e)
{
if (that.isDragging)
{
that.speedX = (stage.mouseX - that.slider.x) - that.clickedX;
that.dragSlide();
}
else
that.autoSlide();
that.speedX *= that.friction;
that.button.x += that.speedX;
that.button.x = that.clamp(that.button.x, that.bar.x + that.buttonWidth * 0.5, that.barWidth - that.buttonWidth * 0.5);
that.clickedX = stage.mouseX - that.slider.x;
});
this.dragSlide = function()
{
that.anim.gotoAndStop(Math.floor(that.anim.timeline.duration * that.button.x / that.barWidth));
};
this.autoSlide = function()
{
that.button.x = (that.barWidth * that.anim.timeline.position) / that.anim.timeline.duration;
};
this.clamp = function(value, min, max)
{
if (value < min)
return min;
else if (value > max)
return max;
else
return value;
};
I hope it helps.