# Need to set and interval

**URL:** https://forum.kirupa.com/t/need-to-set-and-interval/38497
**Category:** Uncategorized
**Created:** [December 23, 2003, 9:28pm UTC](https://forum.kirupa.com/t/need-to-set-and-interval/38497 "2003-12-23T21:28:40Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Reginald](https://avatars.discourse-cdn.com/v4/letter/r/9dc877/32.png) [@Reginald](https://forum.kirupa.com/u/Reginald)
#### Post date: [December 23, 2003, 9:28pm UTC](https://forum.kirupa.com/t/need-to-set-and-interval/38497/1 "2003-12-23T21:28:40Z")

</div>

right, how do I put a delay in my function, i want it to attach the ball, then wait 10 milliseconds, then attach another, how would i go about doing this, thanks

heres my code:

function attach() {  
for (i=0; i\<40; i++) {  
repeat = attachMovie(“ball”, “ball”+i, i);  
repeat.\_x = ((i_3)+30);  
repeat.\_y = ((i_3)+30);  
repeat.\_rotation = (20\*(i\*2));  
}  
}  
attach();

---

<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: [December 23, 2003, 10:03pm UTC](https://forum.kirupa.com/t/need-to-set-and-interval/38497/2 "2003-12-23T22:03:40Z")

</div>

[AS]  
i = 0;  
function attach() {  
//for (i=0; i\<40; i++) {  
if(i \>= 40) {  
clearInterval(interval);  
return;  
}  
repeat = attachMovie(“ball”, “ball”+i, i);  
repeat.\_x = ((i_3)+30);  
repeat.\_y = ((i_3)+30);  
repeat.\_rotation = (20\*(i\*2));  
i++;

//}  
}  
interval = setInterval(attach,10);  
[/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: [December 24, 2003, 11:19am UTC](https://forum.kirupa.com/t/need-to-set-and-interval/38497/3 "2003-12-24T11:19:19Z")

</div>

cheers, nice one
