I have a flash movie that reads its source from an XML document using a simple function:
nav_text.text = navText;
with nav_text as the dynamic text instance (with render text as HTML selected), and navText as a defined variable.
In the XML document, if I write
<navigation
text="Please use the arrows either side of the picture to navigate through this slide show."
/>
Then the SWF movie displays the text exactly as written. However, if the XML document is written as:
<navigation
text="<i>Please use the arrows either side of the picture to navigate through this slide show.</i>"
/>
Then the SWF simply displays 'undefined' in the text box.
Any ideas what I could be doing wrong?
Your problem is because you are using HTML tags in your XML attribute ( <i>
and </i>
in navigation.text ) which are interpreted as XML markup and that's why you will get nothing because XML data parsing is broken. So to avoid that problem, you have to escape these tags using HTML entities ( name or number ):
<i>
=> <i>
or <i>
.</i>
=> </i>
or </i>
.This for XML attributes, for XML elements, you can use CDATA.
Then, after loading xml data, you can do :
text_field.html = true;
text_field.htmlText = your_xml_data;
Hope that can help.