Copy link to clipboard
Copied
I am attempting to display dynamic text from an external xml file. When I trace for the variable, all is well in the output window. But the text does not display in the published movie.
Here is my current code:
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("AskAnExpert.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void {
myXML = new XML(e.target.data);
var topic1:String = myXML.TOPIC[0].TOPIC_NAME;
trace(topic1)
};
On-screen, I have a dynamic text field with an instance name of topic1. When I play the movie, the text does not display. I've tried various options of embedding the text and using _sans, but that doesn't seem to do the trick either. Help!
You say you have a textfield with an instance name of topic1, but in your code you also declare a variable topic1 that you cast as a String. The two cannot coexist. If you really do have a textfield named topic1then assign the xml value to the textfield using...
topic1.text = myXML.TOPIC[0].TOPIC_NAME;
But do not use a varioable with the same name as the textfield
Copy link to clipboard
Copied
You say you have a textfield with an instance name of topic1, but in your code you also declare a variable topic1 that you cast as a String. The two cannot coexist. If you really do have a textfield named topic1then assign the xml value to the textfield using...
topic1.text = myXML.TOPIC[0].TOPIC_NAME;
But do not use a varioable with the same name as the textfield
Copy link to clipboard
Copied
Thank you!
Copy link to clipboard
Copied
You're welcome
Find more inspiration, events, and resources on the new Adobe Community
Explore Now