In a for loop Im adding loaders to differnt mc’s on the scene* (map1, map2, map3 etc)*, now I want to addlisteners but I have problems refering to their parent, anyone see what Im doing wrong?
The 2 funtions at the bottom gives me errors (I did a missing file on purpose to test)
for (var i:Number = 0; i<aantal; i++) {
var map:MovieClip = root["map"+i];
var imgLader:Loader = new Loader();
imgLader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preloading); //doesnt work
imgLader.contentLoaderInfo.addEventListener(Event.COMPLETE, preloadKlaar); //works fine
imgLader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, kwijt); //doesnt work
imgLader.load(new URLRequest(container.dir.attribute('mapthumb')*));
map.addChildAt(imgLader, 1);
}
}
function preloading(event:ProgressEvent):void{
//I need to refer back to the parent here,
// should be smth like "map1 or map2 or map3 etc.."
}
function kwijt(event:IOErrorEvent):void{
//I need to refer back to the parent here,
// should be smth like "map1 or map2 or map3 etc.."
}
thx in advance!