var imgPath:Array = ["pic1.jpg",
"pic2.jpg",
"pic3.jpg",
"pic4.jpg",
"pic5.jpg"];
var img_arr:Array = new Array();
for (var n:int = 0; n < imgPath.length; n++)
{
var imgLoader:Loader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
imgLoader.load(new URLRequest(imgPath[n]));
}
function loadComplete(e:Event):void
{
img_arr.push(e.target.content);
if (imgPath.length == img_arr.length)
{
for (var i:int = 0; i < img_arr.length; i++)
{
addChild(img_arr[i]);
}
}
}
Fonte: http://blog.molanphydesign.com/2008/08/17/loading-multiple-images-in-as3/
Nenhum comentário :
Postar um comentário