Hi,
I want to load multiple pictures using ActionScript. I can do it in AS2 easily. But AS3 is driving me nuts.
I am loading all the images, but I am seeing only the last one. I don’t know how to fix this.
var picWidth:int = 134;
var picGap:int = 13;
var imageLoader:Loader;
var picturesArray:Array= new Array("pic1.jpg", "pic2.jpg", "pic3.jpg", "pic4.jpg");
//Create Movieclip for Pictures
var picMc:MovieClip = new MovieClip();
picMc.x=18;
picMc.y=16;
picMc.name="Big1";
addChild(picMc);
var picLoader:MovieClip = new MovieClip();
var img_arr:Array = new Array();
for (var i:int = 0; i<picturesArray.length; i++) {
var pic:Pictures_mc= new Pictures_mc();
picMc.addChild(pic);
picMc.addChild(picLoader);
pic.x=i*(picWidth+picGap);
picLoader.x=i*(picWidth+picGap)
;
loadImage("galleryPics/"+picturesArray*);
}
function loadImage(url:String):void {
// Set properties on my Loader object
imageLoader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
}
function imageLoaded(e:Event):void {
picLoader.addChild(imageLoader);
}
function imageLoading(e:ProgressEvent):void {
// get current download progress
}