PDA

View Full Version : Stopping a Mouse Controlled Scrolling Menu at either end


Deadhands
06-06-2004, 07:05 PM
Hi people!

I have a horizontal menu of buttons that scrolls depending the _x position of the mouse (yes - the good ol' yugop menu).

These buttons are held in an MC.

On that MC is the following code:


onClipEvent (load) {
xcenter = 165;
speed = 1/40;
}
onClipEvent (enterFrame) {
var distance = _root._xmouse-xcenter;
_x += (distance*speed);
if (_x>0) {
_x = -720;
}
if (_x<-720) {
_x = 0;
}
}


Right now the row of buttons is duplicated once and placed next to the other row so that, with thanx to the 2nd section of code, the menu just keeps going round and round.

What I'm having trouble with is stopping it at either end of the menu.

I have taken the duplicate buttons out so that there is one set, but I'm not sure how to modify the code.

Can anybody help me please!!

Would really appreciate it

Thank you

Deadhands :)

farafiro
06-17-2004, 09:36 AM
is that what u r tryingto doonClipEvent (load) {
xcenter = 200;
speed = 1/40;
}
onClipEvent (enterFrame) {
var distance = _root._xmouse-xcenter;
_x += (distance*speed);
if (_x>720) {
_x = 0;
}
if (_x<0) {
_x = 720;
}
}