# Random Time interval for Dup MC

**URL:** <https://forum.kirupa.com/t/random-time-interval-for-dup-mc/242453>\
**Category:** flash\
**Created:** [October 26, 2007, 2:48am UTC](https://forum.kirupa.com/t/random-time-interval-for-dup-mc/242453 "2007-10-26T02:48:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![horrex](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@horrex](https://forum.kirupa.com/u/horrex)\
**Post date:** [October 26, 2007, 2:48am UTC](https://forum.kirupa.com/t/random-time-interval-for-dup-mc/242453/1 "2007-10-26T02:48:26Z")

</div>

Returning to Flash after a 7 year Hiatus and realised they changed the language on me.

I have “leaf” MC that floats across the screen. It’s affected by a wind generator. I want to duplicate the leaf movie clip at random time intervals (between 2-9 secs).  
I can get the random time interval, I can dup the MC. How do I get it to re-set the interval and dup the MC at the new random time interval?

The final effect I’m after is a MC that reproduces at random intervals every single time.

Some of my code so far:

// set time in between each clip  
var seconds:Number = Math.floor(Math.random()\*(8+1))+2;

// initialize depth  
var depth:Number = 0;

// function that creates clips  
function createClip ():Void  
{  
var mc:MovieClip = attachMovie (“LeafMC”, “LeafMC” + depth, depth, {\_xz, \_y:y});  
depth++;  
stopInterval ();  
}

// start interval  
var intervalID:Number = setInterval (createClip, seconds \* 1000);
