I have a loop which is creating a bunch of MC’s to hold jpg’s and loading jpg’s into them. I wan’t to run some actions on the holder clip when the pic finishes loading.
What would be the best way to do this? Putting my function inside the loop doesn’t work because the entire loop finishes before any of the pics load so any actions are simply going to run i amount of times on the last clip created in the loop. Putting the oncomplete action outside the loop would work, but how do I figure out which clip’s loader just dispatched the complete event?
Here is the general code in case anyone is having trouble visualizing it. Basically, I need to be able to figure out which clip just loaded when onComp() fires so I can resize the pic, position the holder, etc.
//this code is inside a loop
var holder = new picHolder
var myLoader = new Loader
var thumb = myXML.pic*.attribute('thumb')
var req = new URLRequest(thumb)
myLoader.load(req)
holder.addChild(myLoader)
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComp);