Skip to main content
johnc7519608
Participating Frequently
September 30, 2022
Question

Display XML data in a Dynamic Text box

  • September 30, 2022
  • 1 reply
  • 905 views

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 has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
September 30, 2022

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]);

johnc7519608
Participating Frequently
September 30, 2022

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.  

kglad
Community Expert
Community Expert
September 30, 2022

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

 

exactly what do you mean?