# Accessing a movieclip on another level

**URL:** <https://forum.kirupa.com/t/accessing-a-movieclip-on-another-level/21362>\
**Category:** Uncategorized\
**Created:** [May 20, 2003, 9:31pm UTC](https://forum.kirupa.com/t/accessing-a-movieclip-on-another-level/21362 "2003-05-20T21:31:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anarcoma](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@anarcoma](https://forum.kirupa.com/u/anarcoma)\
**Post date:** [May 20, 2003, 9:31pm UTC](https://forum.kirupa.com/t/accessing-a-movieclip-on-another-level/21362/1 "2003-05-20T21:31:08Z")

</div>

Hi. i made this code to dynamically create a menubackground of square tiles. I had no problem here…but then when i try to access them i dont seem to succeed…dont know how too.

heres the first code creating the tilepattern…

amount = 0;  
row = 0;  
horiz = 0;  
vert = 0;  
i = 0;  
while (amount\<24 && row\<4) {  
duplicateMovieClip (\_root.square, “squaremc”+i, i);  
setProperty (“squaremc”+i, \_x, horiz);  
setProperty (“squaremc”+i, \_y, vert);  
setProperty (“squaremc”+i, \_alpha, random(100));  
i++;  
horiz += 26;  
amount++;  
if (amount == 24){  
amount = 0;  
vert += 26;  
horiz = 0;  
row += 1;  
}  
}

then i tried to use THIS code to access each and everyone of the  
movieclips

for (j=0; j\<96;j++){  
trace(\_level[j].squaremc[j].\_x);  
}

the trace says its undefined. whats wrong?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 21, 2003, 12:05pm UTC](https://forum.kirupa.com/t/accessing-a-movieclip-on-another-level/21362/2 "2003-05-21T12:05:57Z")

</div>

\_level[j], and squaremc[j], thats wrong. first, thats just, umm, wrong. thats wrong syntax. second, you dont even need that. you attached them all to the same level. try something like… this:

```auto
for (var j=0; j<96; j++) {
  trace(this["squaremc"+j]._x);
}

```

thats assuming you run this code at the same level of the code that duplicated them.
