Skip to main content
johnc7519608
Participating Frequently
Sep 30, 2022 6:48 PM UTC
Question

Display XML data in a Dynamic Text box

Looking for help in an Adobe Animate HTML5 cavas project. I have a simple xml file that I would like the Amount number to populate a dynamic text box. The dynamic text instance name is DayAmount. 
XML code:

<Total>
<Amount>$62,000</Amount>
</Total>
 
Looking for help what code I would need to use to get the JS to display this number. 
This topic is closed to new replies. Start a new post to keep the conversation going.

13 replies

kglad
Community Expert
Community Expert
Sep 30, 2022 9:39 PM UTC

const xmlStr = '<Total><Amount>$62,000</Amount></Total>';
const parser = new DOMParser();
const doc = parser.parseFromString(xmlStr, "application/xml");

 

your_tf.text= doc.getElementsByTagName("Amount")[0].childNodes[0]);

Translate
johnc7519608
Participating Frequently
Sep 30, 2022 9:46 PM UTC

Sorry, a clearer eplaination is the number in my XML file is a running total that always updating with a new total, I want to be able call to the actual XML file to to pull that number.  

Translate
kglad
Community Expert
Community Expert
Sep 30, 2022 9:55 PM UTC

your first post was clear, and clearly answered. your 2nd post is unclear.

 

exactly what do you mean?

Translate