i want to make a preloading function that could be used by any Loader object I have regardless of name. I’ll explain in code
loader1.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader2.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader1.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader2.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
function loadProgress(e:Event):void{
//how do i get a reference of the object that is calling this function?
trace(targetObject.bytesLoaded); //i want to reference the contentLoaderInfo of the Loader currently using this method
}
function loadComplete(e:Event):void{
addChild(targetObject.parent); //not sure if that's logical
}
I hope i’m making sense.