• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to call XML in Animate cc -AS3

New Here ,
Apr 03, 2021 Apr 03, 2021

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.

Views

163

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 03, 2021 Apr 03, 2021

Copy link to clipboard

Copied

LATEST

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)

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines