在 Loop 中创建后引用 Loader
我正在创建一个循环,将图像加载到新创建的加载器中。每个加载程序完成后,我想将其传递给另一个函数
这是我的加载程序循环,其中 loader_names 是我的加载程序名称的数组,overlay_files 是我的文件 URL 的数组
for (var j:int = 0; j < loader_names.length; j++) {
loader_names[j] = new Loader();
loader_names[j].contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader_names[j].load(new URLRequest(overlay_files[j]));
}
一旦每个图像加载,我想将图像覆盖在地图这里有一个循环,它就是这样做的,只是我不知道如何在加载器完成时将其传递到这个函数中。
function create_overlays(e:Event):void {
for (var k:int = 0; k < loader_names.length; k++) {
overlay_names[k] = new GroundOverlay(loader_names[k],
new LatLngBounds(new LatLng(46.669, -115.035), new LatLng(48.995,-112.079)));
}
}
抱歉,如果这有点混乱,我仍在学习。我很高兴澄清/简化这些内容..
谢谢,
j
I am creating a loop which loadsimages to newly created loaders. After each loader completes, I'd like to pass it through another function
Here's my loop of loaders where loader_names is an array of my loader names and overlay_files is an array of my file URLs
for (var j:int = 0; j < loader_names.length; j++) {
loader_names[j] = new Loader();
loader_names[j].contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader_names[j].load(new URLRequest(overlay_files[j]));
}
Once each image loads I want to overlay the image on a map here's a loop which does just that, only I do not know how to pass loaders into this function as they finish
function create_overlays(e:Event):void {
for (var k:int = 0; k < loader_names.length; k++) {
overlay_names[k] = new GroundOverlay(loader_names[k],
new LatLngBounds(new LatLng(46.669, -115.035), new LatLng(48.995,-112.079)));
}
}
Sorry if this is a bit messy, I am still learning. I am happy to clarify/simplify any of this..
thanks,
j
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑,我误解了你的问题。
在 create_overlays 函数中,您可以使用传入的事件来引用您的加载程序。
将向您推荐触发该事件的加载程序。
Edit, I misunderstood your issue.
In your create_overlays function you can refer to your loader by using the event that is passed in.
will refer you to the loader which fired the event.