# Delay a command

**URL:** <https://forum.kirupa.com/t/delay-a-command/38686>\
**Category:** Uncategorized\
**Created:** [December 28, 2003, 4:58am UTC](https://forum.kirupa.com/t/delay-a-command/38686 "2003-12-28T04:58:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreamer](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@dreamer](https://forum.kirupa.com/u/dreamer)\
**Post date:** [December 28, 2003, 4:58am UTC](https://forum.kirupa.com/t/delay-a-command/38686/1 "2003-12-28T04:58:36Z")

</div>

on (release) {  
play();  
loadMovie(“linkpool/art.swf”, “content”);  
}

I am doing this. However, i want  
loadMovie(“linkpool/art.swf”, “content”);  
only to work 50 frames after the user has click the button.

---

<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 28, 2003, 5:06am UTC](https://forum.kirupa.com/t/delay-a-command/38686/2 "2003-12-28T05:06:42Z")

</div>

Not sure of the setup, but why don’t you just add the loadMovie() code on the frame 50 frames after the user clicks the button.

Either that or check out setInterval() to delay it for a set amount of milliseconds.

---

<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 28, 2003, 5:17am UTC](https://forum.kirupa.com/t/delay-a-command/38686/3 "2003-12-28T05:17:41Z")

</div>

how do you use setInterval() ??

---

<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 28, 2003, 5:27am UTC](https://forum.kirupa.com/t/delay-a-command/38686/4 "2003-12-28T05:27:11Z")

</div>

In this case, it would be something like… [AS]function loadIn(movie) {  
containerClip.loadMovie(movie);  
clearInterval(loadInterval);  
}  
loadInterval = setInterval(loadIn, 1000, “file.swf”);[/AS] (untested) where loadIn is the function that will get run, containerClip is the instance name of the movieclip you are loading to, 1000 is the amount of milliseconds (1 second) to delay before running the function, loadInterval is the intervalID, and file.swf is the file you are loading.

For more information on loadInterval and clearInterval check your local Actionscript Reference (Window/Reference in Flash)

---

<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 28, 2003, 7:28am UTC](https://forum.kirupa.com/t/delay-a-command/38686/5 "2003-12-28T07:28:05Z")

</div>

WOW IT WORKS! thanks a million. everything for my site is coming into place!

---

<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 28, 2003, 5:00pm UTC](https://forum.kirupa.com/t/delay-a-command/38686/6 "2003-12-28T17:00:54Z")

</div>

Glad to hear that 🙂
