Copy link to clipboard
Copied
Hi all!
I am new to animate cc.
How to display a specific XML elements from as3 in a dynamic text box through button.
I have a XML file:
<?xml version="1.0" encoding="utf-8"?>
<details>
<studentname="john" rollno="101201" totalmarks="100" obtainedmarks="85"><stage="1"/>
<studentname="roy" rollno="223254" totalmarks="100" obtainedmarks="80"><stage="1"/>
<studentname="harry" rollno="101388" totalmarks="100" obtainedmarks="75"><stage="1"/>
</details>
If you have any example .FLA please provide
Any help is appreciated.
Thank you.
Copy link to clipboard
Copied
ActionScript uses a thing called E4X. It's a way of accessing XML that makes things a lot easier. But, that doesn't mean it's easy to explain.
See if you can make sense of this article:
https://tournasdimitrios1.wordpress.com/2010/08/07/working-with-xml-e4x-and-actionscript-3/
I changed your XML to make it more correct. You can copy and paste this into Actions in a new AS3 FLA, then test movie, to see what results it gives.
var xml:XML = new XML('<details><student studentname="john" rollno="101201" totalmarks="100" obtainedmarks="85" stage="1"/><student studentname="roy" rollno="223254" totalmarks="100" obtainedmarks="80" stage="1"/><student studentname="harry" rollno="101388" totalmarks="100" obtainedmarks="75" stage="1"/></details>');
var studentdetails:XMLList = xml..student;
trace(studentdetails[2].@studentname)