# Zooming- probably for the advanced of you

**URL:** <https://forum.kirupa.com/t/zooming-probably-for-the-advanced-of-you/43234>\
**Category:** Uncategorized\
**Created:** [February 20, 2004, 2:29am UTC](https://forum.kirupa.com/t/zooming-probably-for-the-advanced-of-you/43234 "2004-02-20T02:29:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Artom](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Artom](https://forum.kirupa.com/u/Artom)\
**Post date:** [February 20, 2004, 2:29am UTC](https://forum.kirupa.com/t/zooming-probably-for-the-advanced-of-you/43234/1 "2004-02-20T02:29:20Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 7:16am UTC](https://forum.kirupa.com/t/zooming-probably-for-the-advanced-of-you/43234/2 "2004-02-20T07:16:45Z")

</div>

```auto
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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 9, 2004, 8:37pm UTC](https://forum.kirupa.com/t/zooming-probably-for-the-advanced-of-you/43234/3 "2004-07-09T20:37:18Z")

</div>

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\>=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);  
};  
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
