Frame 1
function distbetween(x1, y1, x2, y2) {
var x = (x2 - x1);
var y = (y2 - y1);
return(Math.sqrt((x * x) + (y * y)));
}
function onEnterFrame() {
var oldx = ball._x;
var oldy = ball._y;
xv = xv * 0.98;
yv = yv * 0.98;
yv = yv + 5;
ball._x = ball._x + xv;
ball._y = ball._y + yv;
var dist = distbetween(_xmouse, _ymouse, ball._x, ball._y);
var angle = Math.atan2(ball._y - _ymouse, ball._x - _xmouse);
ball._x = (Math.cos(angle) * Math.min(200, dist)) + _xmouse;
ball._y = (Math.sin(angle) * Math.min(200, dist)) + _ymouse;
xv = ball._x - oldx;
yv = ball._y - oldy;
string._x = _xmouse;
string._y = _ymouse;
string._rotation = ((angle / 3.141593) * 180) - 90;
string._yscale = Math.min(200, dist);
string._xscale = 200 - string._yscale;
}
xv = 0;
yv = 0;
ball._color = new Color(ball);
ball._color.setTransform({ra:0, ga:0, ba:100});
ball.onPress = function () {
this._color.setTransform({ra:Math.random() * 100, ga:Math.random() * 100, ba:Math.random() * 100});
};