# Change dynamic text field's xml "value"

**URL:** <https://forum.kirupa.com/t/change-dynamic-text-fields-xml-value/277976>\
**Category:** flash\
**Created:** [December 19, 2008, 3:21pm UTC](https://forum.kirupa.com/t/change-dynamic-text-fields-xml-value/277976 "2008-12-19T15:21:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nasiapostol](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@Nasiapostol](https://forum.kirupa.com/u/Nasiapostol)\
**Post date:** [December 19, 2008, 3:21pm UTC](https://forum.kirupa.com/t/change-dynamic-text-fields-xml-value/277976/1 "2008-12-19T15:21:41Z")

</div>

Hello.

Here is the problem I am facing now!

I want to load an xml value “name [0]” to a dynamic text field which is into a movie clip.  
The movie clip will loop, each time the timeline starts again from frame one ( of the movie clip) I would like to load the same value of the subsequent childnode “name[1]”. When the maximum number of values is reached the changing of the values will stop.

\<?xml version=“1.0” encoding=“utf-8”?\>  
\<polls\>  
\<poll \>  
\<answers\>  
\<answer\>  
\<name\>Michael\</name\>  
\<tally\>0\</tally\>  
\<image\>[www.clipart.com/test.jpg](http://www.clipart.com/test.jpg)\</image\>  
\</answer\>  
\<answer\>  
\<name\>Sophie\</name\>  
\<tally\>0\</tally\>  
\</answer\>  
\</poll\>  
\</polls\>

I have made various attempts but nothing works. ![](http://forum.kirupa.com/uploads/kirupa/2881/dd00c593c8ba56af.gif)

I have used this actionscript.

xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“anim1.xml”);

//this function loads the names[0] value in the movie clip.  
function loadXML(loaded) {  
tmp = [];  
names = [];  
images = [];  
xmlNode = this.firstChild.firstChild.firstChild.childNodes;  
len = xmlNode.length;

i=0;  
tmp\* = xmlNode\*.childNodes;  
names.push(tmp\*[0].firstChild.toString());  
images.push(tmp\*[1].firstChild.toString());  
\_root.posost.valueTXT.text=names\*;

}  
//this action is called in the last frame of the movie clip  
function increment (){  
i++;  
\_root.posost.valueTXT.text="";  
tmp\* = xmlNode[n].childNodes;  
names.push(tmp\*[0].firstChild.toString());  
trace(i);  
if (i\>len){  
\_root.gotoAndStop(5);  
}else{  
\_root.posost.valueTXT.text=names\*;

```
}

```

}

It doesn’t change the value of the text field it says undefined. I traced i and it increments as coded, and when i\>len is true it goes to the frame specified.

Any hints please???  
Any help will be deeply appreciated!
