| UncleDave 2004-02-26, 11:31 am |
| Hello folks.
I'm having a few difficulties with a horizontally scrolling infinite menu on a
flash site I am building.
My problem is that only want the menu to scroll when the mouse is on it, but
at the moment it's scrolls no matter where the mouse is on the page.
Here is the code I have attached to the movie clip
onClipEvent (load)
{
xcenter=347;
speed=1/30;
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
if (_x > 0) _x=-695.1;
if (_x < -695.1) _x=0;
}
At the moment the menu is just an instance of a movie clip that I created, so
perhaps I should be going about this in another way? I have tried fiddling with
mouse coordinates, but nothing seems to be working... bet it's something pretty
silly I'm doing wrong!
Also, if anyone has any tips on easing the speed of the scrolling down to no
movement at all when the mouse leave the scrolling menu that would be great too.
Help much appreciated.
Thanks.
DS
|