Image Scroller Help

Hello guys, I am working a image scroller but instead of scrolling images i am scroling buttons 12 to be exact. I have the code to get it to move from left to rite buti need it to stop when X gets to a certin position and i cant figure it out for the life of me.(still noob) Here is the code.

onClipEvent (enterFrame) {
if (_root._xmouse>300) {
_x -= 5;
} else {
_x += 5;
}
}

Easy enough.
Also i wanted to put the scrolling on an on rollover even of a button. is that possable?
Please let me know
Thanks,
kool