例如XML文件格式如下:
<mp3>
<item title='1' link='/mp3/1.mp3'></item>
<item title='2' link='/mp3/2.mp3'></item>
</mp3>
AS代码如下:
var mp3_xml:XML = new XML();
mp3_xml.onLoad = function(success) {
if (success == true) {
this.ignoreWhite = false;
var t_data = this.firstChild.childNodes;
for (var i = 0; i<t_data.length; i++) {
if (t_data[i].attributes.link != undefined) {
trace("NO."+(i+1)+" title="+t_data[i].attributes.title+" link="+t_data[i].attributes.link);
}
}
} else {
trace(success);
}
};
mp3_xml.load("mp3.xml");
输出结果为:
NO.1 title=1 link=/mp3/1.mp3
NO.2 title=2 link=/mp3/2.mp3
注意:
XML文件路径
<mp3>
<item title='1' link='/mp3/1.mp3'></item>
<item title='2' link='/mp3/2.mp3'></item>
</mp3>
AS代码如下:
var mp3_xml:XML = new XML();
mp3_xml.onLoad = function(success) {
if (success == true) {
this.ignoreWhite = false;
var t_data = this.firstChild.childNodes;
for (var i = 0; i<t_data.length; i++) {
if (t_data[i].attributes.link != undefined) {
trace("NO."+(i+1)+" title="+t_data[i].attributes.title+" link="+t_data[i].attributes.link);
}
}
} else {
trace(success);
}
};
mp3_xml.load("mp3.xml");
输出结果为:
NO.1 title=1 link=/mp3/1.mp3
NO.2 title=2 link=/mp3/2.mp3
注意:
XML文件路径
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}