# XML within textfields - almost there!

**URL:** <https://forum.kirupa.com/t/xml-within-textfields-almost-there/281366>\
**Category:** Uncategorized\
**Created:** [February 8, 2009, 10:50am UTC](https://forum.kirupa.com/t/xml-within-textfields-almost-there/281366 "2009-02-08T10:50:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DH1234](https://avatars.discourse-cdn.com/v4/letter/d/35a633/32.png) [@DH1234](https://forum.kirupa.com/u/DH1234)\
**Post date:** [February 8, 2009, 10:50am UTC](https://forum.kirupa.com/t/xml-within-textfields-almost-there/281366/1 "2009-02-08T10:50:32Z")

</div>

Hello There,

Thanks to those who have helped so far. What I want to happen is…when you click on a button (‘Bengkulu’ for example), the movie should go to and stop at frame 2 (which it does), whilst the textfield (my\_text) should display ‘This is a delightful place in Sumatra’. However, the \<Data\> node’s text won’t display. Why?

Currently, my code looks like this;

```
ActionScript Code:
[LEFT][COLOR=#993300]stop[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];

```

[COLOR=#993300]var[/COLOR] placesXML:[COLOR=#993300]XML[/COLOR] =  
\<places\>  
\<place [COLOR=#993300]name[/COLOR]= [COLOR=#0000FF]“Bengkulu”[/COLOR]\>  
\<frame\>[COLOR=#000000]2[/COLOR]\</frame\>  
\<Data\>This is a deliightful place [COLOR=#993300]in[/COLOR] Sumatra\</Data\>  
\</place\>  
\<place [COLOR=#993300]name[/COLOR]= [COLOR=#0000FF]“Yogyakarta”[/COLOR]\>  
\<frame\>[COLOR=#000000]3[/COLOR]\</frame\>  
\<Data\>This is a deliightful place [COLOR=#993300]in[/COLOR] Java\</Data\>  
\</place\>  
\<place [COLOR=#993300]name[/COLOR]= [COLOR=#0000FF]“Banda\_Aceh”[/COLOR]\>  
\<frame\>[COLOR=#000000]4[/COLOR]\</frame\>  
\<Data\>This is a deliightful place [COLOR=#993300]in[/COLOR] Northern Sumatra\</Data\>  
\</place\>  
\</places\>

[COLOR=#993300]var[/COLOR] nameBtn:[COLOR=#993300]Array[/COLOR] = [COLOR=#000000][[/COLOR]Yogyakarta, Banda\_Aceh, Bengkulu[COLOR=#000000]][/COLOR];  
[COLOR=#993300]var[/COLOR] i:[COLOR=#993300]int[/COLOR] = nameBtn.[COLOR=#993300]length[/COLOR];  
[COLOR=#993300]while[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]  
i–;  
nameBtn[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000000]CLICK[/COLOR], showData[COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#993300]function[/COLOR] showDataCOLOR=#000000[/COLOR]:[COLOR=#993300]void[/COLOR][COLOR=#000000]{[/COLOR]  
[COLOR=#993300]var[/COLOR] xmlFrame:[COLOR=#993300]int[/COLOR] = placesXML._.[COLOR=#000000]([/COLOR]@[COLOR=#993300]name[/COLOR] == [COLOR=#993300]e[/COLOR].[COLOR=#993300]target[/COLOR].[COLOR=#993300]name[/COLOR][COLOR=#000000])[/COLOR].[COLOR=#000000]frame[/COLOR];  
[COLOR=#993300]var[/COLOR] xmlData:[COLOR=#993300]XML[/COLOR] = placesXML._.[COLOR=#000000]([/COLOR]@[COLOR=#993300]name[/COLOR] == [COLOR=#993300]e[/COLOR].[COLOR=#993300]target[/COLOR].[COLOR=#993300]name[/COLOR][COLOR=#000000])[/COLOR].[COLOR=#993300]Data[/COLOR].[COLOR=#993300]text[/COLOR];  
[COLOR=#993300]gotoAndStop[/COLOR]COLOR=#000000[/COLOR];  
my\_text.[COLOR=#993300]text[/COLOR] = xmlData.[COLOR=#993300]toString[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[/LEFT]

However, I keep getting this output message;  
Code:  
TypeError: Error #1034: Type Coercion failed: cannot convert XMLList@2adf251 to XML.  
at textnew\_fla::MainTimeline/showData()  
Cheers!
