[AS3] How do I load external images into a movie clip then add children?

This is what I used in AS2:


importImgs(40);
function importImgs(fNum:Number):Void {
    for (var i = 1; i<=40; i++) {
        this.createEmptyMovieClip("mHolder"+i,fNum);
        eval("mHolder"+i).createEmptyMovieClip("m"+i,eval("mHolder"+i).fNum);
        var mLoader:MovieClipLoader = new MovieClipLoader();
        mLoader.loadClip("img_"+i+".jpg",eval("mHolder"+i));
        fNum--;

    }

}

This just added each image to the stage, one on top of each other.
I would then fade the first image out, revealing the one below; creating a simple slide show of sorts.

I quickly realized having all the clips visible and on screen at once wasn’t the most efficient method.

I’ve since switched to AS3 and need help achieving the same affect.

I’ve read of adding “children” to a container.
This seems to be what I need. Unfortunately the examples I’ve found only deal with 1 container and one child. I’m not sure how to add children so that I may loop through them later.

The desired affect I’m looking for:

An img loading function which will load 3 images at a time until all files are loaded. (essentially preloading)

Adding each image as a child to the main container and set its visibility to false so they are not all visible at once.

I could then make visible two of the images, and fade out the one on top revealing the 2nd image. I would then do this throughout the images in a cycle.

The end affect will look more like a movie than a slide show, as I have to cycle through about 40 sequential images to simulate motion.

I hope this makes sense.

I believe I have the fading technique covered,. I just need help figuring out how to get the elements loaded so i can loop through them.

Thanks in advance :slight_smile:

Steven