# Enlarge movieclip with easing

**URL:** <https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373>\
**Category:** Uncategorized\
**Created:** [February 12, 2003, 5:06am UTC](https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373 "2003-02-12T05:06:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuga](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@shuga](https://forum.kirupa.com/u/shuga)\
**Post date:** [February 12, 2003, 5:06am UTC](https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373/1 "2003-02-12T05:06:13Z")

</div>

i would like to have a movieclip set to a certain size that is kept in a variable then on mouse over i would like the movieclip’s \_xscale and \_yscale to increase by 20 with easing and maybe a lil bounce. i can’t really figure it out though all i can get is

```auto

function(MCenlarge){
myMovieClip._xscale+=20;
myMovieClip._yscale+=20;
}

```

your help is greatly appreciated

---

<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 12, 2003, 5:20am UTC](https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373/2 "2003-02-12T05:20:25Z")

</div>

Use the easing tutorial but change \_x and \_y to \_xscale and \_yscale 😉

---

<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 12, 2003, 5:27am UTC](https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373/3 "2003-02-12T05:27:42Z")

</div>

it doesn’t work ☹

```auto

function(MCenlarge){
	speed = 8;
	endX = this._xscale+20;
	endY = this._yscale+20;
	_xscale += (endX-_xscale)/speed;
	_yscale += (endY-_yscale)/speed;
}

```

then i call it with this on the button

```auto

on(rollOver){
this.MCenlarge();
}

```

---

<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 12, 2003, 5:44am UTC](https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373/4 "2003-02-12T05:44:38Z")

</div>

Your function is written wrong for one.

1. It is function nameOfFunction(){ }

2. You can’t use “this” within a function.

3. I don’t think you need \_xscale and \_yscale in the endX and endY

So your function should look like this…

```php
function MCenlarge() {
	speed = 8;
	endX = 20;
	endY = 20;
	_xscale += (endX-_xscale)/speed;
	_yscale += (endY-_yscale)/speed;
}

```

And to call it, you use \_root, not “this”…

```php
on (rollOver) {
	_root.MCenlarge();
}

```

I didn’t test it, but those could be some things that are wrong.

---

<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 12, 2003, 5:46am UTC](https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373/5 "2003-02-12T05:46:21Z")

</div>

And looking at it again… you define to enterframe so it will just contantly jump to a point.

---

<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 12, 2003, 5:48am UTC](https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373/6 "2003-02-12T05:48:30Z")

</div>

it doesn’t do it still … it just get’s smaller and smaller … no easing … just jumps to the scale value

---

<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 12, 2003, 6:04am UTC](https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373/7 "2003-02-12T06:04:48Z")

</div>

As my previous post stated, you define to onEnterFrame for it to keep working with.

Try using a prototype instead (since you can use “this” with a prototype). Something like this…

```php
MovieClip.prototype.MCenlarge = function(endWidth, endHeight) {
	this.speed = 8;
	this.endX = endWidth;
	this.endY = endHeight;
	this.onEnterFrame = function() {
		this._xscale += (this.endX-this._xscale)/this.speed;
		this._yscale += (this.endY-this._yscale)/this.speed;
	};
};

```

Then on your button (which also has to be a movie clip I believe), do this…

```php
on (rollOver) {
	this.MCenlarge(30, 30);
}
on (rollOut) {
	this.MCenlarge(100, 100);
}

```

The first number there is the \_xscale value and the second number there is the the \_yscale value.

---

<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 12, 2003, 8:29am UTC](https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373/8 "2003-02-12T08:29:04Z")

</div>

savin me as always. thanks beta

---

<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 12, 2003, 8:30am UTC](https://forum.kirupa.com/t/enlarge-movieclip-with-easing/13373/9 "2003-02-12T08:30:50Z")

</div>

No problem 🙂 It is my pleasure!
