Stopping scroll menu at the end

hello i have a scroll menu that continously scrolls, i want the scolling to stop once it reaches the last button in the menu. does anyone know what script is need to stop it when it is at either end of the scroll?

this is the code I have on the scroll mc:

onClipEvent (mouseMove) {
xmousepos1 = _xmouse;
ymousepos1 = _ymouse;
if (ymousepos1>ymousepos2 && xmousepos1>-347 && xmousepos1<-282) {
_root.scrollclip.nextFrame();
}
if (ymousepos1<ymousepos2 && xmousepos1>-347 && xmousepos1<-282) {
_root.scrollclip.prevFrame();
}
if (xmousepos1<-347 || xmousepos1>-282) {
_root.scrollclip.stop();
}
xmousepos2 = _xmouse;
ymousepos2 = _ymouse;
}