我有图像数组,我需要循环抛出它们以获取 url 并通过此函数loadImage加载它们,该函数工作正常并加载图像,当我将图像添加到它时,我的问题与 Movieclip块添加到循环中的最后一个影片剪辑?
var relatedJSON = JSON.decode(e.target.data);
var relatedStories = relatedJSON.stories;
if(relatedStories.length > 0){
for(var j:Number=0;j<relatedStories.length;j++){
if(relatedStories[j].yahki_thumb){
var one = j+1;
var block = related_stories.getChildByName('related_stories_block'+one);
// load the image
loadImage({
path:relatedStories[j].yahki_thumb,
success:function(e:Event,my_loader:Loader)
{
my_loader.width = this[block].width;
my_loader.height = this[block].height;
this[block].img.addChild(my_loader);
},
error:function(e:Event)
{
// error
echo('error to load an image');
}
});
}
}
// replay button event
//replay
}else{
// error
echo('no related stories');
}