Sliding/Infinite Menu

This is how I did it…

onClipEvent (load)
{
xcenter=258.4;
speed=1/50;
}
onClipEvent (enterFrame)
{
if((_root._xmouse>=25) and (_root._xmouse<=541) and(_root._ymouse>=532.8) and (_root._ymouse<=607.8))
{
var distance=(_root._xmouse-xcenter)-1;
_x+=(distance
speed);
if (_x > 0) _x=-914;
if (_x < -914) _x=0;
}
else
{
_x+=(50*0.02);
if (_x > 0) _x=-914;
if (_x < -914) _x=0;
}
}