Hello all. This is my first post… I hope somebody can help.
I completed the “infinite menu” tutorial from the MX special effects section and I’m trying to put it to practical use as a menu for a college project. The problem I’ve got and which I’m really struggling with is how to stop the scroll bar moving once a user has moved the mouse away from the actual menu. It doesn’t look too great when the user goes to another area of the page that the menu is still whizzing all over the place.
Is their a way of designating an ‘active’ area around the menu that reacts to the users mouse movements and then making the scrolling stop once the user has moved away?
I hope I have explained this clearly and I hope somebody can help.
You would have to use a hitTest on that area to see if the mouse is there and then just toggle the speed variable from there - unless you want it to ease to a stop, then it would be a bit different.
I think it would be rather simple - post your fla as it is and I’ll see what I can do. It’s kind of hard to explain what I’m thinking.
[AS]onClipEvent (load) {
var xcenter = 150, speed = .01, decel = .90, accel = 0;
}
onClipEvent (enterFrame) {
var distance = _root._xmouse-xcenter;
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
accel += distance*speed;
}
_x += accel *= decel;
if (_x>0) {
_x = -300;
} else if (_x<-300) {
_x = 0;
}
}[/AS]
Keep in mind that I just took the FLA from the tutorial and modified the code, you’ll have to change some values to suit your needs.
but it still doesn’t seem to be working correctly as it is hardly moving. Any ideas what I’m doing wrong? I’ve placed this script on a menu sitting on the top left hand corner of my home page which is made of 4 text buttons (menu_01, menu_02 etc) created in the standard way.
Any ideas would be great.
ps. I’ve tried several times to attach the swf to this post for you to have a look at but I keep getting an error message saying it doesn’t recognise the file format