[fmx2004]Detecting mouse position

I am new to Flash and Actionscripting. I found a script and am tailoring it to my needs. It is a script that finds the location of the users mouse and then scrolls a menu according to the position of the mouse:

mouseX = _xmouse;
mouseY = _ymouse;
menu_butX = menu_but._x;

if (mouseY > 240 && mouseY < 315) {

if (mouseX > 247) {
diff = (mouseX-247)/30;
if (mouseX < 220) {
diff = (220-mouseX)/30;
if (mouseX <= 247 && menu_butX <= 253) {
setProperty(“menu_but”, _x, menu_butX+diff);
if (mouseX >= 247 && menu_butX >= -6000) {
setProperty(“menu_but”, _x, menu_butX-diff);
if (menu_but._x >= 253) {
menu_but._x = 253;
} else if (menu_but._x <= -6000) {
menu_but._x = -6000;

Very simple I’m sure, but as I am making use of it, I notice clues that may indicate I am doing things improper… when I control>test the movie, the playhead indicates it is repeatedly looping the frames from 1 to 3 (which is how many I have in the main time line) and when I upload and play the movie within a browser, the browser eventually hangs up as if memory is never released (correct terminology?). I have the above code in frame three of the main time line and the movie clip “menu_but” is only one part of the main time line. I would think that the above code would only need to run when the mouse rolls over the movie clip - but this is where I have trouble… when I attempt to have the code be in the time line of the menu_but movie clip and then play only when moused over, the result is an error message that rollover can only be applied to buttons.
Any clues as to the direction I need to be going to solve this would be appreciated.