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);