hi,
Here's a simple example which uses the one you linked to:
PHP Code:
// coordinates that define a rectangle
var top:Number = 0;
var bottom:Number = 200;
var left:Number = 0;
var right:Number = 400;
// mouse position
var xMouse:Number;
var yMouse:Number;
ball_mc.onEnterFrame = function()
{
// if the mouse is withing the rectangle
if (_xmouse > left && _xmouse < right && _ymouse > top && _ymouse < bottom)
{
xMouse = _xmouse;
yMouse = _ymouse;
}
// if the mouse coordinates exist
if (xMouse != undefined && yMouse != undefined)
{
if(Math.abs(xMouse - this._x) < 1) {
this._x = xMouse;
this._y = yMouse;
} else {
this._x -= (this._x-xMouse) / 6;
this._y -= (this._y-yMouse) / 6;
}
}
};