I am making a navigation menu with a grey rectangle that follows the mouse when the mouse is over the menu bar. So far I have this
Code:
onClipEvent(enterFrame){
if(_root._ymouse > 100){
x = _x
x_fin = _root._xmouse
dx = x_fin-x
dx /= 10
_x += dx
}
}
Right now all it does is follows the mouse with easing on the navigation bar. What I want it to do is is the following:
1) Follow the mouse only when the mouse is over the navigation bar area
2) Center align the rectangle with the mouse when it's over the mouse. Right now the left of the rectangle stops by the mouse. I want the rectangle to stop so the mouse is pointing at the center of the rectangle.
3) When clicking on a menu item, the rectangle should stop on that menu item. And when you start pointing with the mouse over the menu bar, the rectangle should follow the mouse but once the mouse leaves the menu bar area the rectangle should return to the menu item.
This should be simple for you actionscript savvy people. So if you're not busy help would be appreciated.