
Код AS1/AS2:
import mx.transitions.Tween;
import mx.transitions.easing.*;
for (var i = 0; i < 5; i++) {
for (var j = 0; j < 5; j++) {
var p = _root.attachMovie("clip", "clip" + i + j, _root.getNextHighestDepth());
p._x = 40 + j * 40;
p._y = 40 + i * 40;
p.startX = p._x;
p.startY = p._y;
p.go = false;
p.onMouseMove = function() {
this.dis = Math.sqrt(Math.pow(_xmouse - this.startX, 2) + Math.pow(_ymouse - this.startY, 2));
if (this.dis < 50 && this.go == false) {
this.go = true;
this.tx.stop();
this.ty.stop();
this.rot.stop();
this.tx = new Tween(this, "_x", Elastic.easeOut, this._x, this.startX + random(100) - 50, 50);
this.ty = new Tween(this, "_y", Elastic.easeOut, this._y, this.startY + random(100) - 50, 50);
this.rot = new Tween(this, "_rotation", Elastic.easeOut, this._rotation, random(360), 50);
}
if (this.dis > 50) {
this.go = false;
this.tx.stop();
this.ty.stop();
this.rot.stop();
this.tx = new Tween(this, "_x", Regular.easeOut, this._x, this.startX, 10);
this.ty = new Tween(this, "_y", Regular.easeOut, this._y, this.startY, 10);
this.rot = new Tween(this, "_rotation", Regular.easeOut, this._rotation, 0, 10);
}
};
}}