我试图在Event.Complete上传递参数,因此一旦它们加载图像,我就可以相应地处理它们的位置,存储它们,等等。请参见下面的代码和输出:
var pic:Array = ["https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png","https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png","https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"];
for (var ii: uint = 0; ii < pic.length; ii++) {
var imageURLRequest:URLRequest = new URLRequest(pic[ii]);
var myImageLoader:Loader = new Loader();
myImageLoader.load(imageURLRequest);
trace ("the ii: " + ii);
myImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,function(evt:Event)
{
doIt(evt,ii)
},false,true);
function doIt(evt:Event,msg:int) {
//var myBitmapData:BitmapData = new BitmapData(myImageLoader.width,myImageLoader.height);
//myBitmapData.draw(myImageLoader);
//var myBitmap:Bitmap = new Bitmap;
//myBitmap.bitmapData = myBitmapData;
trace ("message : " + msg);
}
}
/////Output
the ii: 0
the ii: 1
the ii: 2
the ii: 3
message : 4
message : 4
message : 4
message : 4
///Expected Output
/////Output
the ii: 0
the ii: 1
the ii: 2
the ii: 3
message : 0
message : 1
message : 2
message : 3
感谢您的帮助 Speego