Pan with speed

How to add speed to my pan? This is my code:
main.onPress = function() {
main.startDrag();
detect();
}

main.onRelease = function() {
    this.stopDrag();
}

function detect(){
main.onMouseMove = function() {
main.onEnterFrame = function(){
if (main._x >= stroke._x){
main._x = stroke._x;
delete main.onEnterFrame;
}
if (main._y >= stroke._y) {
main._y = stroke._y;
delete main.onEnterFrame;
}
if (main._x <= (stroke._x - stroke._width/2)) {
main._x = stroke._x - stroke._width/2;
delete main.onEnterFrame;
}
if (main._y <= (stroke._y - stroke._height/2)) {
main._y = stroke._y - stroke._height/2;
delete main.onEnterFrame;
}
}
}
}

I really don’t know where to put it.
Thank you.