# Dynamically creating MC problem

**URL:** <https://forum.kirupa.com/t/dynamically-creating-mc-problem/235370>\
**Category:** flash\
**Created:** [August 10, 2007, 2:35pm UTC](https://forum.kirupa.com/t/dynamically-creating-mc-problem/235370 "2007-08-10T14:35:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cherny013](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@cherny013](https://forum.kirupa.com/u/cherny013)\
**Post date:** [August 10, 2007, 2:35pm UTC](https://forum.kirupa.com/t/dynamically-creating-mc-problem/235370/1 "2007-08-10T14:35:22Z")

</div>

Hi,  
I am creating a web site that will use XML to load content - a sort of video gallery.  
I plan to make scrolling movie clip for navigation containing instances of the single clip - “movie”, which contains thumbnail, title and link, and I plan to use duplicateMovieClip to create as many MCs in navigation as needed.  
But I have the following problem:  
I made a single MC - “movie” that takes the title, description and link from XML.  
I take the lenght of the XML nodes and duplicate the movie clip through the following code, where the variable j is the required number of MCs:

dist = 100; //distance of the new MC  
\_global.k = 0;  
for (i=0; i\<=j-1; i++) {  
// duplicating the movieclip  
duplicateMovieClip (“movie”, “movie”+k, k);  
// setting the y position of the duplicated movieclips  
setProperty (“movie”+k, \_y, dist\*i);  
// incrementing the value of k  
k++;  
}  
}

Everything works OK, the MC is duplicated the right number of times and in the right position, but I cannot pass the required data - variable k to duplicated MC, which has the following code:  
…  
function loadXML(loaded) {  
\_root.naslov = this.firstChild.childNodes[k].childNodes[1].firstChild.nodeValue;  
\_root.opis = this.firstChild.childNodes[k].childNodes[2].firstChild.nodeValue;  
…  
Every of the movies get the same value of the k.

Is there a way to pass the exact value to each of the MCs?

Thanx in advance!
