hey guys, this is what i'm trying to do - make the button cling on to the cursor when the cursor is near enough. is it possible?

this is the code i used. i put it in the first frame. it doesn't work though. i might be approaching the problem in an entirely wrong manner.
--------------

buAboutUs.onMouseMove = function()
{
homeX = this._x;
homeY = this._y;

yDist = Math.abs(thisX - _xmouse);
xDist = Math.abs(thisY - _ymouse);

dist = yDist/xDist;

if (dist <= 30)
{
buAboutUs._x = _xmouse;
buAboutUs._y = _ymouse;
} else
{
buAboutUs._x = homeX;
buAboutUs._y = homeY;
}
};

oh btw, how does one write code here? the one where the font becomes blue.