Zooming- probably for the advanced of you

hey guys,
i always wondered how this effect is done…

let’s say on rollover your button (or text) zooms in and if you rollout really really fast (so it doesn’t reach the 100% percent of the zoomed-in state) it zooms out right back from the frame you left your button at. i think it’s better to show then explain… so please bear with me (i wish i had an example)

say you rollOver a button and it starts to zoom in (in slow mo) 10%, 20%, 30%, 40%, 50%, 60% and then you rollout and it goes down starting from how big it was when you rolled out …60%, 50%, 40%, 30%, 20% etc. so it doesn’t get sent to a 100% keyframe and then starts to get smaller.

share if you know how to get this done,
thanks in advance,

Artom
:bandit:

MovieClip.prototype.zoomInAndOut = function(n, s) {
	this.speed = s;
	this.scale = this._xscale;
	this.zoom = function(d, s) {
		this.onEnterFrame = function() {
			if ((this.scale>=100*n && d == 1) || (this.scale<=100 && d == -1)) {
				delete this.onEnterFrame;
			} else {
				this.scale += d*this.speed;
				this._xscale = this._yscale=this.scale;
			}
		};
	};
	this.onRollOver = function() {
		this.zoom(1);
	};
	this.onRollOut = function() {
		this.zoom(-1);
	};
};
my_movieclip.zoomInAndOut(3, 30);//value of the zoom (3 will make the movieclip 3 times bigger) , speed

Hi I’m trying to modify the code below.
I have two movieclips on the stage.

When you rollover the mc I want it to scale and zoom back to original size on mouse out.
When you click on it I want it to stay scaled.
When you rollover another mc I want the mc that was scaled to zoom back to it’s original size.

MovieClip.prototype.zoomInAndOut = function(n, s) {
this.speed = s;
this.scale = this._xscale;
this.zoom = function(d, s) {
this.onEnterFrame = function() {
if ((this.scale>=100n && d == 1) || (this.scale<=100 && d == -1)) {
delete this.onEnterFrame;
} else {
this.scale += d
this.speed;
this._xscale = this._yscale=this.scale;
}
};
};
this.onRollOver = function() {
this.zoom(1);
};
this.onRollOut = function() {
this.zoom(-1);
};
this.onClick = function() {
this.scale(100);
};
};
a.zoomInAndOut(1.5, 10);
//value of the zoom (3 will make the movieclip 3 times bigger) , speed
b.zoomInAndOut(1.5, 10);

Can someone help me modify this script?
thanks in advance