Slider Help Needed

I’m making a slider that when dragged will snap to certain coordinates (marked by movie clips named M1, m2, m3, m4, m5) and will also advance to the next frame to show the next slide. So basically if the dragger is drug between the x coordinates between 0 and 24 it’ll snap to movie clip m1 at 0 and show frame 1 ; between x-coordinates 25 & 75 it’ll snap to the movie clip m2 on x-coordinate 50 and stop at frame 2, etc.

I took the snap to code from anothe rpost on the forum, but I think it’s interfering with the gotoAndStop (2) code. Here it is.

stop();

dragger.onPress = function() {
this.startDrag(true, 0, 0, line._width, 0);
}
dragger.onRelease = dragger.onReleaseOutside=f;
function f() {
stopDrag();
checkPosition.apply(this);
}
function checkPosition() {
this.targetX = 200;
this.ivar =“Start”
for (var i = 0; i<=5; i++) {
if (Math.abs(this._parent[“m”+i]._x-this._x)<=25) {
this.targetX = this._parent[“m”+i]._x;
this.ivar = i
}
}
this.onEnterFrame = move;
}
function move() {
this._x += (this.targetX-this._x)/3;
if (Math.abs(this.targetX-this._x)<2) {
this._x = this.targetX;
delete this.onEnterFrame;
}
}
if (dragger._x > 25 && dragger._x < 75) {
gotoAndStop(2);
}

Any suggestions will be greatly appreciated. Thank you in advance.