# How can i dynamically attach movies in a loop?

**URL:** https://forum.kirupa.com/t/how-can-i-dynamically-attach-movies-in-a-loop/30767
**Category:** Uncategorized
**Created:** [September 13, 2003, 7:24pm UTC](https://forum.kirupa.com/t/how-can-i-dynamically-attach-movies-in-a-loop/30767 "2003-09-13T19:24:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![chimpo](https://avatars.discourse-cdn.com/v4/letter/c/97f17d/32.png) [@chimpo](https://forum.kirupa.com/u/chimpo)
#### Post date: [September 13, 2003, 7:24pm UTC](https://forum.kirupa.com/t/how-can-i-dynamically-attach-movies-in-a-loop/30767/1 "2003-09-13T19:24:54Z")

</div>

hi, im getting a bit stuck with trying to attach movieclips according to a randomized array (for a card game)  
tempx = 210;  
tempy = 315;  
for (i = 0; i \<13; i ++)

{  
trace((hand1[0]\*[0]_10)+(hand1[0]_[1]));

```
          j = new String(i);

```

//the element in the array give the linkage number  
//i have tried to assign a variable j that increments every time  
// so that can be the referenc name on stage  
//have tried to assign i to be the layyer  
this.attachMovie((hand1[0]\*[0]_10)+(hand1[0]_[1]),j, i);  
this.\_x = tempx;

```
this._y = tempy;

```

//so is positioned right slightly every time  
tempx = tempx +10;  
}

all it seems to do is writeover every card with the next one so all im left with is the last card of the hand being shown

if anyone could help i would much appreciate it!!
