# Pausing AS in AS

**URL:** https://forum.kirupa.com/t/pausing-as-in-as/29378
**Category:** Uncategorized
**Created:** [August 26, 2003, 4:52am UTC](https://forum.kirupa.com/t/pausing-as-in-as/29378 "2003-08-26T04:52:39Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![blah\_de\_blah](https://avatars.discourse-cdn.com/v4/letter/b/a8b319/32.png) [@blah\_de\_blah](https://forum.kirupa.com/u/blah_de_blah)
#### Post date: [August 26, 2003, 4:52am UTC](https://forum.kirupa.com/t/pausing-as-in-as/29378/1 "2003-08-26T04:52:39Z")

</div>

Does anyone know how you can pause an actionscript code? I’ve found posts which explain how to pause animations, but none on how to pause actual actionscript commands :-\

A quick example would be to make a box increase in size (which was done through AS). But when it gets to 100 pixels wide, i want it to pause for 3 seconds before continuing again. Thanks for the help!

---

<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: [August 26, 2003, 6:34am UTC](https://forum.kirupa.com/t/pausing-as-in-as/29378/2 "2003-08-26T06:34:44Z")

</div>

Hi,

You can use the break; command to exit a method. And then at the same time you exit the code you can call an interval that has been made to call another function after 3 seconds, then clear that interval.

Regards,  
Viru.

---

<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: [August 26, 2003, 10:09am UTC](https://forum.kirupa.com/t/pausing-as-in-as/29378/3 "2003-08-26T10:09:27Z")

</div>

Thanks, but what if i don’t have another function to call? And if what i’m exiting is not a method?? :-\

---

<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: [August 26, 2003, 12:29pm UTC](https://forum.kirupa.com/t/pausing-as-in-as/29378/4 "2003-08-26T12:29:08Z")

</div>

Then i cant help, sorry. I dont know how or what to do.

Regards,  
Viru.

---

<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: [August 26, 2003, 2:07pm UTC](https://forum.kirupa.com/t/pausing-as-in-as/29378/5 "2003-08-26T14:07:59Z")

</div>

Use setInterval 🙂

```auto
blabla.onEnterFrame = function() {
 // do stuff
if (this._xscale > 100) {
delete this.onEnterFrame ;
this.interval = setInterval (this, "grow", 3000) ;
}
}

```

where grow could be a nice little prototype that makes a clip grow.

pom 🙂

---

<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: [August 26, 2003, 2:13pm UTC](https://forum.kirupa.com/t/pausing-as-in-as/29378/6 "2003-08-26T14:13:18Z")

</div>

Doesn’t setInterval keep repeating? anyways this is the code i have:

[AS]  
function lengthIn(mc1, finWidth, finHeight) {  
mc1.onEnterFrame = function() {  
mc1.\_width += 30;  
if (mc1.\_width\>=finWidth) {  
mc1.\_width = finWidth;  
//Trying to get the 3 seconds to start here, and then do the stuff under  
mc1.\_height += 30;  
if (mc1.\_height\>=finHeight) {  
mc1.\_height = finHeight;  
delete mc1.onEnterFrame;  
}  
}  
};  
}  
[/AS]

This is what i’m tryin to do (if you look at the comment in the code that is what i want…but i’m not sure how i can do it :-\ thanks!

---

<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: [August 26, 2003, 2:19pm UTC](https://forum.kirupa.com/t/pausing-as-in-as/29378/7 "2003-08-26T14:19:59Z")

</div>

Then again, if i changed the bottom bits to function it should work…then i’d need lots of extra functions though so is there another way?! 😛

---

<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: [August 26, 2003, 2:33pm UTC](https://forum.kirupa.com/t/pausing-as-in-as/29378/8 "2003-08-26T14:33:45Z")

</div>

> \*Originally posted by blah-de-blah \*  
> \*\*Doesn’t setInterval keep repeating? \*\*  
> All you have to do is clear the interval in the grow function.

Check Sen’s site, he has a good explanation of all this 🙂
