简体   繁体   中英

Problem reading XML with AS3

How can i call a specific image tag based on the size parameter of my XML in AS3? I know that track.image will return all the image tags but i am unsure of how to target a specific image tag based on the size tag. My XML is as follows. Cheers in advance for any help.

<track>
  <name>Hello</name>
  <image size="small"></image>
  <image size="medium"></image>
  <image size="large"></image>
</track>

This will test for a specific attribute:

var myImagePath:String = yourXML.image.(@size == "small");

Where yourXML is the xml object...

If your xml tree is more complicated, just dot your way down from the root. Also - the root node is implied by flash, so you can leave it out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM