Hi Everyone,
I’m importing text via an XML file that will then be displayed in a dynamic text field. The text is about 1 sentence long but one of the words in the sentence must be bold and a different color. So I’ve added some HTML tags in the XML node to change the color and format but when I test the file the html tags show in the dynamic text field and the text is NOT formatted. I’m not sure what I’m doing wrong.
Here is my code:
I bring in the XML data with this AS3 code:
var _xml:XML;
var _xmlList:XMLList;
var _xmlLoader:URLLoader = new URLLoader();
_xmlLoader.load(new URLRequest("xml/step1.xml"));
_xmlLoader.addEventListener(Event.COMPLETE, loadXMLData);
function loadXMLData(event:Event):void
{
_xml = XML(event.target.data);
_xmlList = _xml.children();
//trace(_xmlList[_arrayIndex].quest);
test_txt.text = _xmlList[0].quest;
}
And this is what my XML file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<questions>
<question>
<quest><![CDATA[According to the national average, how many<font color="#C50100"><b> home fires</b></font> occur each day in the United States?]]></quest>
</question>
</questions>
Am I not using the CDATA tag properly? Or do I need to change something in the way I call up the data in the xml node ?I’m really confused as to what isn’t working. Thanks in advance for the help.