# \[FlashCS3-AS2\] duplicate mc, random \_y help

**URL:** <https://forum.kirupa.com/t/flashcs3-as2-duplicate-mc-random--y-help/242948>\
**Category:** flash\
**Created:** [October 31, 2007, 10:27pm UTC](https://forum.kirupa.com/t/flashcs3-as2-duplicate-mc-random--y-help/242948 "2007-10-31T22:27:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stanmc](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@stanmc](https://forum.kirupa.com/u/stanmc)\
**Post date:** [October 31, 2007, 10:27pm UTC](https://forum.kirupa.com/t/flashcs3-as2-duplicate-mc-random--y-help/242948/1 "2007-10-31T22:27:02Z")

</div>

Greetings - I’ve been prowling and found a start for what I’m trying to do. Need help refining it. I pilfered the snowconfetti.fla AS and have modified it, but not quite there.  
I want to attach a MC at a random \_y location, and move it left to right across the stage, at random speeds. Then when it goes offstage, a new one is generated.  
Right now the interval loads a new clip at 8 sec. no matter where the current clip resides on stage, so I’m sure that is wrong.

```auto
function brand() {
    clip = attachMovie("brand_mc", "brand"+i, i);
    clip._x = -50;
    clip._y = Math.floor(Math.random()*640);
    clip.xspeed = Math.random()*4-1;
    clip.onEnterFrame = move;
    i++;
    if(i > 20){
        clearInterval(myInterval);
    }
}
function move() {
    this._x += this.xspeed;
    if (this._x>1100) {
        this.removeMovieClip();
        brand();
    }
}
myInterval = setInterval(brand, 8000);

```

Thanks much for the help!
