# MC scaling

**URL:** <https://forum.kirupa.com/t/mc-scaling/57050>\
**Category:** flash\
**Created:** [July 9, 2004, 8:39pm UTC](https://forum.kirupa.com/t/mc-scaling/57050 "2004-07-09T20:39:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajeanne26](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@ajeanne26](https://forum.kirupa.com/u/ajeanne26)\
**Post date:** [July 9, 2004, 8:39pm UTC](https://forum.kirupa.com/t/mc-scaling/57050/1 "2004-07-09T20:39:07Z")

</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.

```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);
};
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

---

<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, 9:44pm UTC](https://forum.kirupa.com/t/mc-scaling/57050/2 "2004-07-09T21:44:50Z")

</div>

> [@ajeanne26](#):
>
> 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.
> 
> This isn`t very tidy but it works (mx)  
> 2 movieclips mc1 & mc2
> 
> function scaler(clip, maxS) {  
> if (clip.\_xscale\<=maxS) {  
> clip.\_xscale = clip.\_yscale += 5;  
> } else {  
> clip.\_xscale = clip.\_yscale=maxS;  
> clearInterval(sinterval);  
> }  
> }  
> function reducer(clip, minS) {  
> if (clip.\_xscale\>=minS) {  
> clip.\_xscale = clip.\_yscale -= 5;  
> } else {  
> clip.\_xscale = clip.\_yscale=minS;  
> clearInterval(rinterval);  
> }  
> }  
> mc1.onRollOver = function() {  
> clearInterval(rinterval);  
> if (!this.pressed) {  
> sinterval = setInterval(scaler, 20, this, 300);  
> }  
> };  
> mc1.onRollOut = function() {  
> clearinterval(sinterval);  
> if (!this.pressed) {  
> rinterval = setInterval(reducer, 20, this, 100);  
> }  
> };  
> mc1.onPress = function() {  
> this.pressed = true;  
> clearInterval(rinterval);  
> clearinterval(sinterval);  
> };  
> mc2.onRollOver = function() {  
> clearInterval(rinterval);  
> clearinterval(sinterval);  
> rinterval = setInterval(reducer, 20, mc1, 100);  
> mc1.pressed = false;  
> };
> 
> ```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);
> };
> 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
