# Add delay and Play button

**URL:** https://forum.kirupa.com/t/add-delay-and-play-button/36445
**Category:** flash
**Created:** [November 26, 2003, 7:06pm UTC](https://forum.kirupa.com/t/add-delay-and-play-button/36445 "2003-11-26T19:06:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Sandman9](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Sandman9](https://forum.kirupa.com/u/Sandman9)
#### Post date: [November 26, 2003, 7:06pm UTC](https://forum.kirupa.com/t/add-delay-and-play-button/36445/1 "2003-11-26T19:06:01Z")

</div>

Ok … today’s a new day so here goes

I have a movie that’s one frame long. It has a container MC on it which has the following script:

```auto
onClipEvent (enterFrame) {
if (_root["load"+this._name]) {
if (total_bytes == null) {
total_bytes = this.getBytesTotal();
} else {
loaded_bytes = this.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
percent_done = Math.round((loaded_bytes/total_bytes)*100);
_root.bar.gotoAndStop(percent_done);
if (percent_done >= 100) {
trace ("fully loaded");
_root["load"+this._name] = false;
_root.loadNext();
}
}
}
}

```

On the one and only frame of my movie I have:

```auto
count = 0;
numMoviesToLoad = 5;
function loadNext () {
_root["loadcontainer"+count] = false;
_root.bar.gotoAndStop(1);
if (count<numMoviesToLoad) {
count++;
var newName = "container"+count;
_root.container.duplicateMovieClip(newName, count);
with (this[newName]) {
_x = 0;
_y = 0;
}
loadMovie ("pics/w"+count+".jpg", _root[newName]);
_root["load"+newName] = true;
}
}
loadNext();

```

This all works fine as you can see. But it loads one pic right after one another. What I’ve been trying to do is make a delay so it waits 3-4 seconds before loading the next pic. I’ve try’d a getTimer and setInterval but I guess my experience level isn’t there yet for me to get it working with the above (been driving me crazy).

The reason I’m doing this is because I need to add a play button so when you hit play it loads the pics sequentially with a 3-4 second delay inbetween

Any help would be great right now

Cheers  
Sandman9
