# Actionscript delay or pause

**URL:** <https://forum.kirupa.com/t/actionscript-delay-or-pause/218655>\
**Category:** flash\
**Created:** [March 9, 2007, 2:13pm UTC](https://forum.kirupa.com/t/actionscript-delay-or-pause/218655 "2007-03-09T14:13:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IManarchy](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@IManarchy](https://forum.kirupa.com/u/IManarchy)\
**Post date:** [March 9, 2007, 2:13pm UTC](https://forum.kirupa.com/t/actionscript-delay-or-pause/218655/1 "2007-03-09T14:13:44Z")

</div>

OK.

I need a function or some way to create a pause in between calls to a function and setInterval doesn’t seem to be working.

Basically, I have several movie clips in the library named movie1, movie2, etc… Each contains a fading movie clip. I want to attach them all using actionscript, but i want to wait like 5 secs in between each one and i can’t seem to get it to do that.

Here is the code i have so far without setInterval. It cause them all to appear on the screen at once.

var numOfEmployees = 4;  
for (var i=1; i \<= numOfEmployees; i++) {  
var thisName = “movie” + i;  
attachClip(thisName);  
}

function attachClip(thisName){  
thisMovie = \_root.attachMovie(thisName, thisMovie + i, this.getNextHighestDepth())  
thisMovie.\_x = 100;  
thisMovie.\_y = (\_root.\_height - thisMovie.\_height) - 100;  
}

Now, this will make all movie clips appear on screen at the same time. What is the best way to create a 5 second delay between each call to attach clip? What is the proper way to use setInterval or is their a better way??

I need a solution that doesn’t use the timeline at all, possibly just a function that would work like this…  
for (var i=1; i \<= numOfEmployees; i++) {  
var thisName = “movie” + i;  
attachClip(thisName);  
**wait(5);**  
}

Anyone know of a function like that? Thanks.

Anyhelp would be greatly appreciated.
