Can I make the scrolling of the infinite menu conditional on the y position of the mouse cursor?
I have fiddled with if functions to no avail, I only want the menu to move when the mouse is positioned within its borders: eg. not elsewhere on the page.
i’m not sure what you have tried exactly but you might try replacing
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
}
with
onClipEvent (enterFrame){
if (_ymouse>top && _ymouse<bottom){
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
}
}
replace top with the y coordinate for the top of the menu and replace bottom with the y coordinate for the bottom of the menu
essentially, i’ve taken the function that tells the menu to move and told it to only happen when the mouse is between the vertical coordinates where the menu is
onClipEvent (enterFrame) {
if (_root._ymouse>60 && _root._ymouse<80) {
var distance = _root._xmouse-xcenter;
_x += (distance*speed);
}
}
Works like a charm. On a side note; am I to assume that flash doesnt work with inequalities, because I tried some almost identical code which didnt work.
Seeing as my inequality means exactly the same as your bit of code, the only reason I can see for it not working is that flash doesn’t recognise inequalitys.
no i’ve used innequalities in flash before, that looks like it should work except for the space between the numbers and the parens, you don’t need that. but i’m glad my code worked for you
The space is meaningless, I would’ve auto formatted anyway… maybe I put my “if” outside of the onClipEvent handler… silly mistake if that is the case, but thats me for you.
Anyway, thanks… the constant movement of the menu was doing my head in.