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!