# Populate a Dynamic Text field with an XML attribute

**URL:** <https://forum.kirupa.com/t/populate-a-dynamic-text-field-with-an-xml-attribute/273528>\
**Category:** flash\
**Created:** [October 16, 2008, 2:11pm UTC](https://forum.kirupa.com/t/populate-a-dynamic-text-field-with-an-xml-attribute/273528 "2008-10-16T14:11:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscar33139](https://avatars.discourse-cdn.com/v4/letter/o/f14d63/32.png) [@oscar33139](https://forum.kirupa.com/u/oscar33139)\
**Post date:** [October 16, 2008, 2:11pm UTC](https://forum.kirupa.com/t/populate-a-dynamic-text-field-with-an-xml-attribute/273528/1 "2008-10-16T14:11:20Z")

</div>

Hello everyone,

Slightly new to actionscript and xml. I got my images to show up within my movieclips in flash. What I am having trouble with is my dynamic text box. What should I use to load my attribute into my dynamic text box? I have included the actionscript and xml:

var imgName = “”;  
var mc = “”;  
var rollover = “”;  
var mcRoll = “”;  
var mcTitle = “”;  
var mcText = “”;

myXML = new XML();  
myXML.ignoreWhite = true;  
myXML.onLoad = function(success){  
if(success){

for (i=0; i\<myXML.childNodes[0].childNodes.length; i++) {

```
     imgName = myXML.childNodes[0].childNodes*.firstChild.nodeValue;
     mc = myXML.childNodes[0].childNodes*.attributes.name;
     
     mcRoll = myXML.childNodes[0].childNodes*.attributes.rollmc;
     rollover = myXML.childNodes[0].childNodes*.attributes.rollover;
    
     
     mcTitle = myXML.childNodes[0].childNodes*.attributes.desc;
     mcText = myXML.childNodes[0].childNodes*.attributes.descName;
     
     loadMovie(imgName, mc);
     loadMovie(rollover, mcRoll);

```

//here is where I am having trouble, should I even use load.text?//  
load.text(mcText, mcTitle);  
//here is where I am having trouble//  
}

} else {  
//error loading the XML  
}  
}  
myXML.load(“header\_images.xml”);

//xml file//

\<images\>  
\<image name=“pic1” rollmc=“pic1o” rollover=“images/pic1over.jpg” desc=“title1” descName=“BOUQUET BOUTONNIERE”\>images/pic1.jpg\</image\>  
\<image name=“pic2” rollmc=“pic2o” rollover=“images/pic2over.jpg” desc=“title2” descName=“WEDDING CAKE”\>images/pic2.jpg\</image\>  
\<image name=“pic3” rollmc=“pic3o” rollover=“images/pic3over.jpg” desc=“title3” descName=“CENTERPIECES”\>images/pic3.jpg\</image\>  
\<image name=“pic4” rollmc=“pic4o” rollover=“images/pic4over.jpg” desc=“title4” descName=“CEREMONY DECOR”\>images/pic4.jpg\</image\>  
\<image name=“pic5” rollmc=“pic5o” rollover=“images/pic5over.jpg” desc=“title5” descName=“SEATING”\>images/pic5.jpg\</image\>  
\<image name=“pic6” rollmc=“pic6o” rollover=“images/pic6over.jpg” desc=“title6” descName=“TABLE SEATING”\>images/pic6.jpg\</image\>  
\</images\>

I am able to trace the descName, but I can’t populate the dynamic text box with the results.
