Basically I’m loading images from a xml file. For each image adds it into a movieclip and tries to attach a preloader.
The images load just fine, but when adding the preloader, it adds one to each movieclip, but only 1 of them actually show the preloader working.
Here is the code for that section below.
Any suggestions on what to try?
for(var i:uint = 0; i < myXml.children().length(); i++) {
var imageRequest:URLRequest = new URLRequest(myXml.image*);
var imageLoader:Loader = new Loader();
imageLoader.load(imageRequest);
addChild(this['photo'+i]);
this['photo'+i].containerClip_mc.addChild(imageLoader);
this['photo'+i].containerClip_mc.addChildAt(preloader_mc,1);
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
function progressHandler(event:ProgressEvent):void {
var loadProgress:Number = event.target.bytesLoaded / event.target.bytesTotal;
preloader_mc.barClip_mc.scaleX = loadProgress;
preloader_mc.loadTextField_txt.text = Math.round(loadProgress * 100) + "%";
}