# Creating empty movie clips in "for" loop

**URL:** <https://forum.kirupa.com/t/creating-empty-movie-clips-in-for-loop/219993>\
**Category:** Uncategorized\
**Created:** [March 21, 2007, 7:01pm UTC](https://forum.kirupa.com/t/creating-empty-movie-clips-in-for-loop/219993 "2007-03-21T19:01:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mastermode](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mastermode](https://forum.kirupa.com/u/mastermode)\
**Post date:** [March 21, 2007, 7:01pm UTC](https://forum.kirupa.com/t/creating-empty-movie-clips-in-for-loop/219993/1 "2007-03-21T19:01:06Z")

</div>

so…here’s a toughie. i have an xml file  
\<xmlfile\>

```
&lt;file name="numero1" /&gt;
&lt;file name="numero2" /&gt;
&lt;file name="numero3" /&gt;
&lt;file name="numero4" /&gt;

```

\</xmlfile\>

they can have any names, this is just an example. so…and in my actionscript panel, i have the code:

the var bit…  
myxml.ignorewhite = true;  
max = 40

myxml.onLoad = function() {  
var nodes:Array = this.firstChild.childNodes;  
for(i=0;i\<nodes.length;i++) {  
myarray.push(nodes\*.attributes.name);

following this code, still in the for loop, i tried to create an empty movie clip, which loads a secondary swf, called “button.swf”. as follows

this.createEmptyMovieClip(“myMC”,i) // “i” being the depth  
myMC.\_x = 40;  
myMC.\_y = max;  
max += 45 //so as the swfs don’t overlap  
myMC.loadMovie(“button.swf”);  
}}

so…when i run the movie, it all appears blank. just for your information, if i take the whole ‘‘movie clip creation’’ bit out of the whole loop, it works fine. just once, but fine:D  
you got the idea what i’m trying to do here… it’s a list of buttons… because i don’t want to use the list component. anyway, continuing. i don’t know how to make it work.  
i’ve been guessing the problems might be with the same instance myMC bit, and i don’t know how to create a different one each time(i’ve been trying though:D ) or with the depth…which still i can’t figure it out.

so…help is very welcomed.

thanks for reading so far  
cheers
