# Delay For Loop

**URL:** <https://forum.kirupa.com/t/delay-for-loop/253189>\
**Category:** flash\
**Created:** [February 27, 2008, 11:13pm UTC](https://forum.kirupa.com/t/delay-for-loop/253189 "2008-02-27T23:13:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Advantage](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@Advantage](https://forum.kirupa.com/u/Advantage)\
**Post date:** [February 27, 2008, 11:13pm UTC](https://forum.kirupa.com/t/delay-for-loop/253189/1 "2008-02-27T23:13:46Z")

</div>

Hello,  
after looking all over google, and many other sites  
and decompiling flash… looking at useless examples,  
I’ve broken down and need some help with this simple function.

My problem is that I have 6 pictures, I need to automatically  
cycle through this list of pictures after about 15 seconds.

After 4 hours, the best idea i have is to use a for loop  
and then try to somehow delay the loop. Which has been  
a great unsuccess… I have tried if, if else, if elseif else, and  
nearly every other kind of loop or statement that I could think of  
and here is my code right now…

btn(1-6) refers to a button  
pics is the instance name of the movie clip that all the pictures are stored in

```auto

chngPic = setInterval(changePic,1500);
myDelay = setInterval(delay,2000);

function delay() {
    trace("im just sitting here");
}

function changePic() { 
  var i = 1; 
    for(i=1;i<7;i++){ 
        stkDown("btn"+i); 
        pics.gotoAndPlay("pic"+(i ));
        delay;
    } 
}

```

I’m not really an ActionScript guru, and really need some help on this.  
If you have any concepts for me to try, or a code, anything, please  
let me know what you have for me.
