# Staggering AttachMovie Problem

**URL:** https://forum.kirupa.com/t/staggering-attachmovie-problem/169997
**Category:** flash
**Created:** [November 21, 2005, 11:03pm UTC](https://forum.kirupa.com/t/staggering-attachmovie-problem/169997 "2005-11-21T23:03:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Fargate](https://avatars.discourse-cdn.com/v4/letter/f/dbc845/32.png) [@Fargate](https://forum.kirupa.com/u/Fargate)
#### Post date: [November 21, 2005, 11:03pm UTC](https://forum.kirupa.com/t/staggering-attachmovie-problem/169997/1 "2005-11-21T23:03:24Z")

</div>

I’ve been trying to make an asteroids game but when I use the following script to attach asteroid movie clips in random positions I cannot figure how to stagger the attaching process. What I mean by this is say I’m going to have 25 asteroids come down from the top of the screen in total how do I properly script this so they come down not all at once but, with delay in between each one. This is the script I have been trying so far but I cannot get it to work:

[AS]  
lastAsteroid = 0;  
for (i=0; i\<=25; i++) {  
if (lastAsteroid\<=getTimer()) {  
myAsteroid = attachMovie(“asteroid”, “asteroid”+\_root.getNextHighestDepth(), \_root.getNextHighestDepth());  
myAsteroid.\_x = random(550);  
myAsteroid.\_y = random(-100);  
myAsteroid.\_xscale = random(80)+80;  
myAsteroid.\_yscale = \_root[“asteroid”+i].\_xscale;  
myAsteroid.\_rotation += random(50)+20;  
myAsteroid.onEnterFrame = function() {  
this.\_y += random(7)+3;  
};  
}  
lastAsteroid++;  
}  
[/AS]

Any help on how to resolve this would be greatly appreciated :D!

Thanks,

Fargate 🙂
