Infinit menu and buttonlinking

Hello I have a problem,
When I use the following code then I can put a link in the buttons of the menu to go to another framelabel.

onClipEvent (load)
{
xcenter=294;
speed=1/70;
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
}

onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
if (_x > 0) _x=-408;
if (_x < -408) _x=0;
}

When add the following code above this the buttons don’t work anymore

on(rollOver){
speed=1/30;
}on(rollOut){
speed=1/900;
{

onClipEvent (load)
{
xcenter=294;
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
}

onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
if (_x > 0) _x=-408;
if (_x < -408) _x=0;
}

I use this code to make the rolling menu stop when I roll out of it.
Is there anyone who can help me with this.

Thanks