Load images into separate movie clips from a XML, Flash, Actionscript 3.0
- by James Dunay
I have an xml image bank, pretty standard, and I have a loader, along with movie clips that I want the images loaded into, the problem that I am running into is I want the images to load into separate movie clips, so I’m using a case statement to specify where they go. However, I can only get them to load into a single movie clip, I assume they are loading ontop of each other and I don’t know how to get them to separate out. I’ll post my code. It doesn’t make any sense to me but if you have any suggestions that would be real great.
I can make separate loaders and then just do 1 image per loader, but that just doesn’t sound right to me.
var counterNumber:Number = 0;
function callThumbs():void{
for (var i:Number = 0; i <3; i++){
thumbLoaded();
counterNumber++;
}
}
function thumbLoaded(){
var photoLoader = new Loader();
switch (counterNumber){
case 1:
photoLoader.load(new URLRequest(MovieClip(this.parent).xml.photos.imageOne.image.@url[0]));
whole.boxOne.pictureLoader.addChild(photoLoader);
trace("1Done");
break;
case 2:
photoLoader.load(new URLRequest(MovieClip(this.parent).xml.photos.imageTwo.image.@url[0]));
whole.boxTwo.pictureLoader.addChild(photoLoader);
trace("2Done");
break;
}
}