【发布时间】:2010-11-03 20:50:00
【问题描述】:
我正在使用 AS3 在 Flash 中制作一个高分表,我已经成功地获得了显示名称和分数的工作代码,但它也是我的高分表的一部分,它需要显示用户的国家/地区标志。标志的图像存储在远程服务器上。
现在我知道如何加载单个图像并将其添加到我的影片剪辑中,但是当我想通过循环迭代加载 20+ 时,事情变得非常复杂。我查看了很多示例,但无法采用示例代码为我工作。无论如何,我到目前为止没有进一步的操作。
// Load High scores from server
var hiscoreloader:URLLoader = new URLLoader();
hiscoreloader.addEventListener(Event.COMPLETE, highScoresLoaded);
var hiscorexml:XML;
function highScoresLoaded(e:Event):void
{
hiscorexml = new XML(e.target.data);
var hsList:XMLList = hiscorexml.highscores.highscore;
for(var i:uint = 0; i < hsList.length(); i++)
{
this["hs_score_"+i].text = zeroPad(hsList.score.text()[i], 8);
this["hs_name_"+i].text = hsList.name.text()[i];
// Load in Flag
// url of flag will be: "http://wfwxg.philosophydesign.com/images/flags/" + hsList.country.text()[i] + ".png"
// Move clip instance name the above image needs adding too will be: this["hs_flag_"+i]
}
}
hiscoreloader.load(new URLRequest("http://wfwxg.philosophydesign.com/includes/top20.php?nocache=" + new Date().getTime()));
谁能修改我的代码来做我想做的事?
非常感谢
斯科特
【问题讨论】:
标签: flash actionscript-3 image load