# Setinterval and attachmovie problem

**URL:** https://forum.kirupa.com/t/setinterval-and-attachmovie-problem/198219
**Category:** Uncategorized
**Created:** [August 23, 2006, 8:44am UTC](https://forum.kirupa.com/t/setinterval-and-attachmovie-problem/198219 "2006-08-23T08:44:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![daytonatkf](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@daytonatkf](https://forum.kirupa.com/u/daytonatkf)
#### Post date: [August 23, 2006, 8:44am UTC](https://forum.kirupa.com/t/setinterval-and-attachmovie-problem/198219/1 "2006-08-23T08:44:03Z")

</div>

i try to run a movie clip for an amount of time (39, 40, etc), this movie clip is a object which moving to a location (x,y). so i try using interval for 1 second, but the problem is every second it load new movie clip and remove the previous one. So the out put is like looping of a object moving for one second only, not yet reach the location (x,y) yet. When i use button (click), it work, i click 5 times, it show 5 object moving to the location(x,y)

here is the script

on(press)  
{  
setInterval(pass,1000);  
function pass()  
{  
\_root.population += 1;  
\_root.attachMovie(“pass”, “m”+\_root.population, this.getNextHighestDepth());  
\_root[“m”+\_root.population].play();  
}  
}

any idea to make it loop for an amount of time for automatic? thanks for reply
