Here it is!
onClipEvent (load) {
var acceleration = 0.005;
var termVelocity = 20;
var yVel = 0;
var xVel = 0;
var e = 0.8;
var f = 0.8;
var dragged = 0;
}
onClipEvent (enterFrame) {
if (this._y<380) {
if (dragged == 0) {
yVel += (termVelocity-yVel)*acceleration;
}
} else if (this._y>380) {
yVel *= -1*e;
xVel *= f;
this._y = 380;
}
if (this._x>530) {
xVel *= -1*e;
yVel *= f;
this._x = 530;
} else if (this._x<20) {
xVel *= -1*e;
yVel *= f;
this._x = 20;
}
if (dragged == 0) {
this._y += yVel;
this._x += xVel;
}
}
on (press) {
this.startDrag(false);
dragged = 1;
velocity = 0;
xVel = 0;
}
on (release, releaseOutside) {
this.stopDrag();
dragged = 0;
}