MC frames looping

Hi guys,

My action scripting is pretty basic. I’m trying to get this script to not loop. I basically have a MC on stage and have two script functions used for it, the drag function and the mousewheel function. I’m using both scripts to play MC’s frames. Once you start dragging to the right or left, it starts playing the frame and then loops to either the beginning or the end. Samething with the mousewheel function.

I’d like to have both scripts stop the drag when it reaches the final frame or the first frame, so instead of looping, I’d like it to completely stop. Any help would be greatly appreciated. Thanks!

Here’s the code for both functions-

mousewheel function:



object.stop();
var targetFrame:Number = 1;
var mouseListener:Object = new Object();
mouseListener.onMouseWheel = function(delta:Number) {
	if (delta > 0) {
		targetFrame = object._currentframe - 1;
	} else {
		targetFrame = object._currentframe + 1;
	}
		if (targetFrame > object._totalframes) {
		targetFrame = 1;
	} else if (targetFrame < 1) {
		targetFrame = object._totalframes;
	}
		object.gotoAndStop(targetFrame);
};
Mouse.addListener(mouseListener);

drag function:


onClipEvent(load){
	stop();
	speed = 15; 
}
onClipEvent(mouseDown){
	xRef = _parent._xmouse;
	frameRef = _currentframe;
}
onClipEvent(mouseMove){
	if (Key.isDown(1)){ 
		frame = (frameRef + Math.floor((_parent._xmouse - xRef)/speed)) % _totalframes;
		if (frame <= 0) frame = _totalframes + frame;
		gotoAndStop(frame);
	}
}