Hi, I made a code which gives function to an object follow the mouse within an specific area. I am very poor in English. So I can’t explain it more. Just check the code and try to improve it.
this.onEnterFrame = function() {
if (bg_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
positionX = _root._xmouse;
positionY = _root._ymouse;
circle._x = circle._x+(positionX-circle._x)/5;
circle._y = circle._y+(positionY-circle._y)/5;
} else {
circle._x = circle._x+(bg_mc._x-circle._x)/5;
circle._y = circle._y+(bg_mc._y-circle._y)/5;
}
};