# Help with assigning xml nodes to text field

**URL:** <https://forum.kirupa.com/t/help-with-assigning-xml-nodes-to-text-field/264049>\
**Category:** flash\
**Created:** [June 22, 2008, 5:34pm UTC](https://forum.kirupa.com/t/help-with-assigning-xml-nodes-to-text-field/264049 "2008-06-22T17:34:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kramp1502](https://avatars.discourse-cdn.com/v4/letter/k/eb8c5e/32.png) [@kramp1502](https://forum.kirupa.com/u/kramp1502)\
**Post date:** [June 22, 2008, 5:34pm UTC](https://forum.kirupa.com/t/help-with-assigning-xml-nodes-to-text-field/264049/1 "2008-06-22T17:34:49Z")

</div>

Hi there everybody,  
I was wondering if someone can help me with assigning the values from an xml file to textfields within four movieclips on my stage  
I have four movieclips:  
intance names = one, two,three, four  
in each one there are 3 text fields  
nametag\_txt  
comment\_txt  
description\_txt

i am currently importing my xml using the following code on frame 1 of root:  
//Load XML Data  
function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
nametag\_txt = [];  
comment\_txt = [];  
description\_txt = [];  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
nametag\_txt\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
comment\_txt\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
description\_txt\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;

}  
} else {  
trace(“Error loading XML”);  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“inventors.xml”);  
xmlData.onLoad=function(){  
trace(xmlData);  
}  
stop();

The xml is coming into flash no problem.  
on the timeline of clip one i have the following code :  
stop();  
nametag\_txt.text = nametag\_txt[0];  
comment\_txt.text = comment\_txt[0];  
description\_txt.text = caption\_txt[0];  
on the timeline of clip two i have :  
nametag\_txt.text = nametag\_txt[1];  
comment\_txt.text = comment\_txt[1];  
description\_txt.text = caption\_txt[1];

This is not working though - could somebody point me in the right direction please. It’s driving me crackers!!!  
the .fla and xml file are attached in a zip file. i am using flash pro 8

Thanks very much in advance
