Sum of the Squares of the two legs of a right triangle is equal to the square of the hypotenuse.
A^2 + B^2 = C^2
var dist:Number;
var circle:Circle;
function onStageEnter(event) {
var dx:Number = event.target.x - mouseX;
var dy:Number = event.target.y - mouseY;
dist = Math.sqrt(dx*dx + dy*dy);
event.target.alpha = 1-(dist/250);
distText.text = String(dist);
distText.x = mouseX;
distText.y = mouseY+20;
}
for (var i:int = 1; i<=7; i++) {
for (var j:int = 1; j<=5; j++) {
circle = new Circle();
circle.x = (i*circle.width)-circle.width;
circle.y = (j*circle.height)-circle.height;
circle.addEventListener(Event.ENTER_FRAME, onStageEnter);
addChild(circle);
}
}