MovieClip.prototype.motion = function(variable, target, speed) { if (this[variable] != target) { if (!this.broadcastMessage) { AsBroadcaster.initialize(this); } this.onEnterFrame = function() { dif = target-this[variable]; if (Math.abs(dif)>.5) { this[variable] += dif/speed; } else { this[variable] = target; this.broadcastMessage("ready"); delete this.onEnterFrame; } }; } };