从网上看到一个FLASH XML新闻的例子 发现一个问题[已解决]
时间:2010-12-21
来源:互联网
function createNewsList(total, array) {
var movieclip = newsList.news.newMc;
var i = 0;
while (i<total) {
var depth = movieclip._parent.getNextHighestDepth();
movieclip.duplicateMovieClip("new"+i,depth);
var mc = eval("newsList.news.new"+i);
mc._x = -360;
mc.id = i;
var titleVar = "<b>"+array[0][i].date+" - "+array[0][i].title+"</b>";
mc.titleTxt.htmlText = titleVar;
//mc.descTxt.htmlText = array[0][i].shortdesc;
//mc.txt.htmlText = array[0][i].link;
var delay = 100*i;
setTimeout(setClipPos,delay,i,mc);
if (array[0][i].link != undefined) {
mc.link = array[0][i].link;
mc.bg.onPress = function() {
_root.txt=mc.link;
};
mc.bg.onRollOver = function() {
this.up = true;
this.play();
};
mc.bg.onRollOut = mc.bg.onReleaseOutside=function () {
this.up = false;
this.play();
};
}
// end if
++i;
}// end while
arrangeArticles(movieclip,total);
}// End of the function
这段代码。无法正确获取XML里的 link 字节
只能获取XML最后一个LINK里的网址。。
求教。这个问题是什么问题啊
xml是:
<?xml version="1.0" encoding="utf-8" ?>
<dataroot>
<news>
<new>
<title>新闻标题1</title>
<shortdesc><![CDATA[第一篇]]></shortdesc>
<date>01/01/2009</date>
<link>1</link>
</new>
<new>
<title>新闻标题2</title>
<shortdesc><![CDATA[第二篇]]></shortdesc>
<date>01/01/2009</date>
<link>2</link>
</new>
<new>
<title>新闻标题3</title>
<shortdesc><![CDATA[第三篇]]></shortdesc>
<date>01/01/2009</date>
<link>3</link>
</new>
<new>
<title>新闻标题4</title>
<shortdesc><![CDATA[第四篇]]></shortdesc>
<date>01/01/2009</date>
<link>4</link>
</new>
</news></dataroot>
var movieclip = newsList.news.newMc;
var i = 0;
while (i<total) {
var depth = movieclip._parent.getNextHighestDepth();
movieclip.duplicateMovieClip("new"+i,depth);
var mc = eval("newsList.news.new"+i);
mc._x = -360;
mc.id = i;
var titleVar = "<b>"+array[0][i].date+" - "+array[0][i].title+"</b>";
mc.titleTxt.htmlText = titleVar;
//mc.descTxt.htmlText = array[0][i].shortdesc;
//mc.txt.htmlText = array[0][i].link;
var delay = 100*i;
setTimeout(setClipPos,delay,i,mc);
if (array[0][i].link != undefined) {
mc.link = array[0][i].link;
mc.bg.onPress = function() {
_root.txt=mc.link;
};
mc.bg.onRollOver = function() {
this.up = true;
this.play();
};
mc.bg.onRollOut = mc.bg.onReleaseOutside=function () {
this.up = false;
this.play();
};
}
// end if
++i;
}// end while
arrangeArticles(movieclip,total);
}// End of the function
这段代码。无法正确获取XML里的 link 字节
只能获取XML最后一个LINK里的网址。。
求教。这个问题是什么问题啊
xml是:
<?xml version="1.0" encoding="utf-8" ?>
<dataroot>
<news>
<new>
<title>新闻标题1</title>
<shortdesc><![CDATA[第一篇]]></shortdesc>
<date>01/01/2009</date>
<link>1</link>
</new>
<new>
<title>新闻标题2</title>
<shortdesc><![CDATA[第二篇]]></shortdesc>
<date>01/01/2009</date>
<link>2</link>
</new>
<new>
<title>新闻标题3</title>
<shortdesc><![CDATA[第三篇]]></shortdesc>
<date>01/01/2009</date>
<link>3</link>
</new>
<new>
<title>新闻标题4</title>
<shortdesc><![CDATA[第四篇]]></shortdesc>
<date>01/01/2009</date>
<link>4</link>
</new>
</news></dataroot>
作者: darksos 发布时间: 2010-12-21
mc.bg.onPress = function() {
_root.txt=this._parent.link };
_root.txt=this._parent.link };
作者: flash023 发布时间: 2010-12-22
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28