# AttachMovie clip not working as i hoped it would!

**URL:** <https://forum.kirupa.com/t/attachmovie-clip-not-working-as-i-hoped-it-would/234436>\
**Category:** flash\
**Created:** [August 2, 2007, 6:45am UTC](https://forum.kirupa.com/t/attachmovie-clip-not-working-as-i-hoped-it-would/234436 "2007-08-02T06:45:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![four4swords](https://avatars.discourse-cdn.com/v4/letter/f/87869e/32.png) [@four4swords](https://forum.kirupa.com/u/four4swords)\
**Post date:** [August 2, 2007, 6:45am UTC](https://forum.kirupa.com/t/attachmovie-clip-not-working-as-i-hoped-it-would/234436/1 "2007-08-02T06:45:01Z")

</div>

hey,

Well… I have this script here… which dynamically attaches a movie clip onto my stage…

```auto
on (release) {
    d = random(100);
    _root.attachMovie("Item", "Item"+d, 0, {_x:random(300), _y:100});
    trace(d);
}

```

I have it in a button… Use to initiate it…

Anyway… It’s suppose to attach a movie clip named “Item”… from my library… and give it another name… due to the “Item”+d… and “d” is a random number…

Since my Movie clip has a difference instance name every time it is attached… it shouldn’t interfere with each other…

But what i get is that every time i click it… the old one just vanishes and the new one takes it’s place…

What’s going on there?

Thanks

[Edit]  
Ok… I’ve resolved this… by using a loop…
