# Could someone give me an example?

**URL:** https://forum.kirupa.com/t/could-someone-give-me-an-example/25954
**Category:** flash
**Created:** [July 17, 2003, 11:59pm UTC](https://forum.kirupa.com/t/could-someone-give-me-an-example/25954 "2003-07-17T23:59:39Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![zeusevine](https://avatars.discourse-cdn.com/v4/letter/z/258eb7/32.png) [@zeusevine](https://forum.kirupa.com/u/zeusevine)
#### Post date: [July 17, 2003, 11:59pm UTC](https://forum.kirupa.com/t/could-someone-give-me-an-example/25954/1 "2003-07-17T23:59:39Z")

</div>

…Of an action script that would tween a movie clip so that it gradually gets bigger? So far I’ve been action scripting by example; composing is a killer for me.

---

<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 18, 2003, 12:06am UTC](https://forum.kirupa.com/t/could-someone-give-me-an-example/25954/2 "2003-07-18T00:06:48Z")

</div>

For beginners, but this on the movie clip…  
[AS]  
//when clip loads  
onClipEvent(load) {  
//set this clips width to 10  
this.\_width = 10  
//set this clips height to 10  
this.\_height = 10  
//set variable to hold the speed  
speed = 5  
}  
//every time clip enters the frame  
onClipEvent(enterFrame){  
//increase the width by the current speed  
//this basically says this.\_width = this.\_width+value of speed variable  
this.\_width += speed  
//do the same for the height  
this.\_height += speed  
}[/AS]

Theres your start… now you take it from there :thumb:

---

<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 18, 2003, 12:08am UTC](https://forum.kirupa.com/t/could-someone-give-me-an-example/25954/3 "2003-07-18T00:08:32Z")

</div>

Thank you!

---

<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 18, 2003, 12:46am UTC](https://forum.kirupa.com/t/could-someone-give-me-an-example/25954/4 "2003-07-18T00:46:13Z")

</div>

try this as well,

onClipEvent(load){  
speed = 5; // Change this variable if you want.  
}

onClipEvent(enterFrame){  
this.\_xscale += speed;  
this.\_yscale += speed;  
}

This should work I think 🙂

---

<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 18, 2003, 12:56am UTC](https://forum.kirupa.com/t/could-someone-give-me-an-example/25954/5 "2003-07-18T00:56:28Z")

</div>

Thanks! They both work great! But there’s a little bit of distortion when I use the former one. The animation starts off somewhat narrow then gets wider. It helped when I adjusted the width. How come this is so?

…And how do you make the animation stop after a certain 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: [July 18, 2003, 2:49am UTC](https://forum.kirupa.com/t/could-someone-give-me-an-example/25954/6 "2003-07-18T02:49:28Z")

</div>

It all depends on the height and width of your clip on how it will scale, so you will need to adjust it to work.

And to stop the animation use an if statement… something like

[AS]  
//if the width is greater than or equal to the final width number  
if (this.\_width \>= finalWidthNumber ){  
//keep the width at the final width number  
this.\_width = finalWidthNumber;  
}[/AS]

---

<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 19, 2003, 2:44am UTC](https://forum.kirupa.com/t/could-someone-give-me-an-example/25954/7 "2003-07-19T02:44:34Z")

</div>

Deleted.
