All pastes #175120 Raw Edit

Someone

public text v1 · immutable
·published 2006-09-18 14:39 UTC
rendered paste body
MovieClip.prototype.motion = function(variable, target, speed) {
	if (this[variable] != target) {
		if (!this.broadcastMessage) {
			AsBroadcaster.initialize(this);
		}
		this.createEmptyMovieClip('motion'+variable, this.getNextHighestDepth());
		this['motion'+variable].onEnterFrame = function() {
			dif = target-this._parent[variable];
			if (Math.abs(dif)>.5) {
				this._parent[variable] += dif/speed;
			} else {
				this._parent[variable] = target;
				this._parent.broadcastMessage("ready");
				this._parent['motion'+variable].removeMovieClip();
			}
		};
	}
};