All pastes #522261 Raw Edit

Anonymous

public javascript v1 · immutable
#522261 ·published 2007-05-30 11:13 UTC
rendered paste body
import mx.transitions.Tween;var boxes:Array = ["box1", "box2", "box3", "box4", "box5"];for (var i:Number = 0; i<boxes.length; i++) {	this[boxes[i]].onRelease = function() {		var emptyPos:Array = new Array();		emptyPos.push(this._x, this._y);		var dx:Number = this._x-empty._x;		var dy:Number = this._y-empty._y;		dist = Math.sqrt(dx*dx+dy*dy);		if (dist<=51) {			new Tween(this, "_x", easeOut, this._x, empty._x, 0.2, true);			new Tween(this, "_y", easeOut, this._y, empty._y, 0.2, true);			empty._x = emptyPos[0];			empty._y = emptyPos[1];		}	};}