Unable to load images into each MC?
Posted
by Hwang
on Stack Overflow
See other posts from Stack Overflow
or by Hwang
Published on 2010-03-27T08:15:02Z
Indexed on
2010/03/27
8:23 UTC
Read the original article
Hit count: 444
The images only loads into the last MC, how to make it load into each MC?
private function imageHandler():void {
imageBox=new MovieClip();
imageBox.graphics.lineStyle(5, 0xFFFFFF);
imageBox.graphics.beginFill(0xFF0000);
imageBox.graphics.drawRect(0,0,150,225);
imageBox.graphics.endFill();
allImage.addChild(imageBox);
}
private function getPhoto():void {
for (i=0; i<myXMLList.length(); i++) {
placePhoto();
imageHandler();
imagesArray.push(imageBox);
imagesArray[i].x=20+(200*i);
}
addChild(allImage);
allImage.x=-(allImage.width+20);
allImage.y=-(allImage.height+50);
}
private function placePhoto():void {
loadedPic=myXMLList[i].@PIC;
galleryLoader = new Loader();
galleryLoader.load(new URLRequest(loadedPic));
galleryLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,picLoaded);
}
private function picLoaded(event:Event):void {
bmp=new Bitmap(event.target.content.bitmapData);
bmp.smoothing=true;
imageBox.addChild(bmp);
}
© Stack Overflow or respective owner