# Problem with xml and actionscript

**URL:** <https://forum.kirupa.com/t/problem-with-xml-and-actionscript/241419>\
**Category:** flash\
**Created:** [October 13, 2007, 6:04pm UTC](https://forum.kirupa.com/t/problem-with-xml-and-actionscript/241419 "2007-10-13T18:04:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GlitchFF](https://avatars.discourse-cdn.com/v4/letter/g/6bbea6/32.png) [@GlitchFF](https://forum.kirupa.com/u/GlitchFF)\
**Post date:** [October 13, 2007, 6:04pm UTC](https://forum.kirupa.com/t/problem-with-xml-and-actionscript/241419/1 "2007-10-13T18:04:28Z")

</div>

Hi everybody!

I’m new on this forum and was wandering if someone could help me with a problem.

I’ve need to attach several movieClips with textfield on the stage. Those movieClips then need to load information from a xml file into those textfiels. The only thing is that every  
movieClip needs to draw different information out of the XML file.

I know how to create and attach the movieClips to the stage. And how I can draw information out of the XML file. Every attached movieClip is getting it’s own instance name of c1 to c25. And of course when i want to insert the information from the xml file i use:

nRoot.contentMain.c1.name.text = xmlObject.attributes.name;

The only thing is that the next movieClip will be called nRoot.contentMain. **c2**.name  
So I want the script to automatically change the number into the next number.

I’ve tried this using a for statement. But this doesn’t seem to work. I tried this:

var i = 0;  
for(i=0;i\<totalProducts;++i){  
nRoot.contentMain.c+i.name.text = xmlObject.attributes.name;  
}

Where totalProducts is a number that the script uses to see how many products the xml file has.

I hope someone can help me.

Thanks in advance.  
Greets GlitchFF
