
Код AS1/AS2:
var blocks:Array = [];
var total:Boolean;
function circles(obj){
blocks.push(obj);
obj.collision = function(x, y) {
this.distX = (x - this._x) * (x - this._x);
this.distY = (y - this._y) * (y - this._y);
this.dist = this.distX + this.distY;
this.hit = Math.sqrt(this.dist) <= this._width / 2;
}
}
onEnterFrame = function(){
total = false;
for (l in blocks)
{
circle = blocks[l];
circle.collision(_xmouse, _ymouse);
total = total || circle.hit;
}
txt1.text = blocks[0].hit;
txt2.text = blocks[1].hit;
txt3.text = blocks[2].hit;
txt.text = total;
}