求助AS2脚本问题
时间:2011-02-24
来源:互联网
小弟用一段脚本读取外部xml文件,并加上链接,光读取文件时就碰到问题,运行后总是提示“undefined”,不知道哪位大侠能帮瞎忙,并且能把链接加上?这里先谢谢了。下面附上代码,源文件在附件里。
var myxml = new XML();
System.useCodepage = true;
myxml.ignoreWhite = true;
myxml.load("news.xml");
myxml.onLoad = function(success) {
if (success) {
port = myxml.firstChild.childNodes;
//动态文本显示第一条数据内部的值(从0算起是第一个)
t1.text = port[0].attributes.title;
t2.text = port[1].attributes.title;
t3.text = port[2].attributes.title;
t4.text = port[3].attributes.title;
t5.text = port[4].attributes.title;
t6.text = port[5].attributes.title;
t7.text = port[6].attributes.title;
t8.text = port[7].attributes.title;
t9.text = port[8].attributes.title;
t10.text = port[9].attributes.title;
} else {
trace("载入失败");
};
};
as2.zip (367.41 KB)
var myxml = new XML();
System.useCodepage = true;
myxml.ignoreWhite = true;
myxml.load("news.xml");
myxml.onLoad = function(success) {
if (success) {
port = myxml.firstChild.childNodes;
//动态文本显示第一条数据内部的值(从0算起是第一个)
t1.text = port[0].attributes.title;
t2.text = port[1].attributes.title;
t3.text = port[2].attributes.title;
t4.text = port[3].attributes.title;
t5.text = port[4].attributes.title;
t6.text = port[5].attributes.title;
t7.text = port[6].attributes.title;
t8.text = port[7].attributes.title;
t9.text = port[8].attributes.title;
t10.text = port[9].attributes.title;
} else {
trace("载入失败");
};
};

作者: ycmspace 发布时间: 2011-02-24
没人会吗?
作者: ycmspace 发布时间: 2011-02-24
t1.text = port[0].attributes.title;改为t1.text = port[0].attributes.name;
其他同之
其他同之
作者: xiedodo77 发布时间: 2011-02-24
先谢谢,我试下再说
作者: ycmspace 发布时间: 2011-02-24
好用了,不好意思,是我自己写错了,xml中以前是title后来改了,flash中忘了改了。
我想实现读取xml中url的链接,然后给flash中文本加上链接应该怎么写???谢谢
我想实现读取xml中url的链接,然后给flash中文本加上链接应该怎么写???谢谢
作者: ycmspace 发布时间: 2011-02-24
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28