# Publish problem + loading instances of a single clip randomly on the stage

**URL:** <https://forum.kirupa.com/t/publish-problem-loading-instances-of-a-single-clip-randomly-on-the-stage/209998>\
**Category:** flash\
**Created:** [December 13, 2006, 11:30pm UTC](https://forum.kirupa.com/t/publish-problem-loading-instances-of-a-single-clip-randomly-on-the-stage/209998 "2006-12-13T23:30:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oli\_G](https://avatars.discourse-cdn.com/v4/letter/o/f05b48/32.png) [@Oli\_G](https://forum.kirupa.com/u/Oli_G)\
**Post date:** [December 13, 2006, 11:30pm UTC](https://forum.kirupa.com/t/publish-problem-loading-instances-of-a-single-clip-randomly-on-the-stage/209998/1 "2006-12-13T23:30:31Z")

</div>

I’ve now a CPU friendly firework clip that needs to be randomly generated on the stage, using the following code;

dupMovie = function () {

for (i=0; i\<100; i++) {

circle.duplicateMovieClip(“circle”+i, i, {\_x:Math.random()\*300, \_y:Math.random()\*200, \_alpha:Math.random()\*50});  
with (eval(“circle”+i)) {

\_xscale = \_yscale=Math.random()\*300;

}

}

};  
dupMovie();

But I need to somehow throw an interval in there that calls the dupmovie function so that they appear on the stage with a duration of anywhere between 0.1 and 1 second between them. But I don’t imagine that to be too tricky.

Although i’m at a roadblock, because the code that ‘draws’ the firework itself is Flash 5 code, and wont work with flash player 8;

i = 2;  
while (Number(i)\<150) {  
duplicateMovieClip(“isk1”, “isk” add i, i);  
setProperty(“isk” add i, \_rotation, random(360));  
scalefactor = 40+Number(random(60));  
setProperty(“isk” add i, \_xscale, scalefactor);  
setProperty(“isk” add i, \_yscale, scalefactor);  
i = Number(i)+1;  
}

So I can’t get to the random placement part of it without optimizing the above for Flash 8.

If anyone has any pointers it would be muchos appreciated.
