我一直被挑战从Tomcat中获取这个xml文件
$<?xml version="1.0" encoding="UTF16"><mkc><stamp><color>bronze</color><source>whatsdifferent</source><date>1313774664000</date <$/stamp><stamp><color>silver</color><source>whatsdifferent</source><date>1313775030000</date$></stamp><stamp><color>bronze</color><source>whatsdifferent</source><date>1314736005000</da$te></stamp></mkc>
并将其设置为可在哪里找到图像的网址
“../图像/ whatsdifferent_bronze.png” “../images/whatsdifferent_silver.png” 等等。
在AS3中。
如何做到这一点?
答案 0 :(得分:1)
这可以通过解析xml来完成,如:
var xmldata : XML =
<mkc>
<stamp>
<color>bronze</color>
<source>whatsdifferent</source>
<date>1313774664000</date>
</stamp>
<stamp>
<color>silver</color>
<source>whatsdifferent</source>
<date>1313775030000</date>
</stamp>
<stamp>
<color>bronze</color>
<source>whatsdifferent</source>
<date>1314736005000</date>
</stamp>
</mkc>;
for each(var child : XML in xmldata.stamp){
var url : String = "../images/"+child.source+"_"+child.color+".png";
trace(url);
}