简体   繁体   English

使用AS3读取XML时出现问题

[英]Problem reading XML with AS3

How can i call a specific image tag based on the size parameter of my XML in AS3? 如何在AS3中基于XML的size参数调用特定的图像标签? 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. 我知道track.image将返回所有图像标签,但是我不确定如何基于大小标签来定位特定的图像标签。 My XML is as follows. 我的XML如下。 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... yourXML是xml对象...

If your xml tree is more complicated, just dot your way down from the root. 如果您的xml树更加复杂,则只需从根向下点即可。 Also - the root node is implied by flash, so you can leave it out. 另外-根节点由Flash隐含,因此可以将其省略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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