# XML Value to text field

**URL:** <https://forum.kirupa.com/t/xml-value-to-text-field/240076>\
**Category:** flash\
**Created:** [September 28, 2007, 7:35pm UTC](https://forum.kirupa.com/t/xml-value-to-text-field/240076 "2007-09-28T19:35:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flabbygums](https://avatars.discourse-cdn.com/v4/letter/f/58956e/32.png) [@flabbygums](https://forum.kirupa.com/u/flabbygums)\
**Post date:** [September 28, 2007, 7:35pm UTC](https://forum.kirupa.com/t/xml-value-to-text-field/240076/1 "2007-09-28T19:35:27Z")

</div>

```auto
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("file.xml"));

function loadXML(e:Event):void {
var myXML = new XML (e.target.data);
for each (var name:XML in myXML..name)
trace (name)
trace (typeof name)
activeParts_txt.text = name
}

```

The above traces this: but my text field only shows “Dartboard”

Garage Items  
Big Engine  
Flames  
Graffiti  
Calendar  
Oil Cans  
Tool Chest  
Dartboard  
xml

But if I switch the order of the two trace statements to:

```auto
trace (typeof name)
trace (name)

```

It traces this:

xml  
xml  
xml  
xml  
xml  
xml  
xml  
xml  
Dartboard

In both cases my text field only displays “Dartboard”. I guess I need to convert this XML it a string somehow? I tried setting name to an XMList but that didn’t do much.

Thanks.
