Image scroller keeps going & going & going

Hi,

My original goal was to drag&click/scroll horizontally a very wide image. I found and tried to transform a free panoramic scroller but I can’t figure out how to restrict the image to its own width, instead it keeps going on on either side when the picture ends. I like the motion and I don’t want to change the scrolling type. It’s fine as is except for that little thing. Any simple tip?

–stage size is 1020 x 550
–image size is 3700x550
–The AS2 code is:

function initImageScroll() {
introState = “fadein”;
}
function ImageScroll() {
if (introState == “fadein”) {
b = ImageStroke1._alpha+14;
if (b>=100) {
b =100;
}
ImageStroke1._alpha = b;
}
if (state == “scroll”) {
stepX = (startX-_xmouse)/5;
ImageStroke1._x = ImageStroke1._x + stepX;
}
}
initImageScroll();
this.onEnterFrame = function() {
ImageScroll();
};
Mouse.hide();
cursor_mc.startDrag(“true”);

–oh and the associated ImageStroke1 (the image mc) code is: -

this.onPress = function() {
var _l2 = _root;
_l2.state = “scroll”;
_l2.startX = _l2._xmouse;
};
this.onRelease = this.onReleaseOutside=function () {
_root.state = “off”;
};