# \[Flash 8 AS2\] Problems with Attach/Duplicate MC

**URL:** <https://forum.kirupa.com/t/flash-8-as2-problems-with-attach-duplicate-mc/294621>\
**Category:** flash\
**Created:** [August 17, 2009, 5:22pm UTC](https://forum.kirupa.com/t/flash-8-as2-problems-with-attach-duplicate-mc/294621 "2009-08-17T17:22:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hashshashin](https://avatars.discourse-cdn.com/v4/letter/h/a698b9/32.png) [@Hashshashin](https://forum.kirupa.com/u/Hashshashin)\
**Post date:** [August 17, 2009, 5:22pm UTC](https://forum.kirupa.com/t/flash-8-as2-problems-with-attach-duplicate-mc/294621/1 "2009-08-17T17:22:50Z")

</div>

Im building a new game, the idea is you collect things which fall from the top with your mouse, and when you touch them, it attach’s a fading movieclip. I have done rpetty much this:

[http://u1.imgupload.co.uk/1250463600/8727\_lol.swf](http://u1.imgupload.co.uk/1250463600/8727_lol.swf)

On the falling Items I have this:

```auto

onClipEvent (load) {
    
    function reset() {
        this._visible = true;
        this._x=random(50);
        this._y=random(0);
        fallspeed=0.1;
    }
    reset();
}
onClipEvent (enterFrame) {
    gravity=0.1;
    fallspeed += gravity;
    this._y+=fallspeed;
    
    if (_y > 545) {
    reset(); 
    }
}
onClipEvent (enterFrame) {
 if(_root.five.hitTest(_root.cursor)){ 
 xvar = this._x
 yvar = this. _y
_root.attachMovie("Bomb", "Fiveexploasion", 1, {_x:xvar, _y:yvar}); 
     _root.gold += 5
     this._visible = false;
    this.gotoAndPlay(2);
    reset(); 
 } 

}

```

The bit to look at, I hope, is this:

```auto

onClipEvent (enterFrame) {
 if(_root.five.hitTest(_root.cursor)){ 
 xvar = this._x
 yvar = this. _y
_root.attachMovie("Bomb", explosion", 1, {_x:xvar, _y:yvar}); 
     _root.gold += 5
     this._visible = false;
    reset(); 
 } 

}

```

So if it falls down, it spawns back up, if your mouse hits it, it disspears with the explosion/fading “bomb” mc in its place.

The problem:  
If I hit one, and it starts to fade, and then hit another, before the prevoius one has faded, then, annoyingly, the previous fade disspears and restarts at the new one I just hit.

Im looking for a way to avoid this, I was thinking of Duplicating the movieclip, but I cant find a way for it to work.

Im also looking for a way to, spawn them activily randomly, so more than one on the screen at a time. Im not sure how to do this, so could I please get some help!

If you find me a way, I shall put you in the credits!

Thank you!
