BitmapData with external images

Hi,

I am trying to build some cool image transitions using the BitmapData class, the problem i have is that most of the tutorials and sample code i have found require the images to bae in the library. I want them to be brought in externally and the below code seems to do this:

function duplicateMC(mc1:MovieClip,mc2:MovieClip,mc3:MovieClip) {
    trace (mc1)
//create a new bitmapData object with the same width,height as the external image being loaded in, preserve transparency incase loaded image is a cutout, give bitmap a colour
mcBMP = new BitmapData(mc1._width, mc1._height, true, 0x00FFFFFF);
mcBMP2 = new BitmapData(mc2._width, mc2._height, true, 0x00FFFFFF);
mcBMP3 = new BitmapData(mc3._width, mc3._height, true, 0x00FFFFFF);
//copy the mc holding the external image into the newly created bitmap object
mcBMP.draw(mc1);
mcBMP2.draw(mc2);
mcBMP3.draw(mc3);
images = [mcBMP,mcBMP2,mcBMP3]
//run slicing function passing it the newly created Bitmap object.
startTransition(clips, images[index], speed, delay); 
}

//creating 2 empty movie clips
this.createEmptyMovieClip("holder", this.getNextHighestDepth());
this.createEmptyMovieClip("holder1", this.getNextHighestDepth());
this.createEmptyMovieClip("holder2", this.getNextHighestDepth());

//loading external jpg to "holder" mc
loadMovie("cutout.png", holder);
loadMovie("img1.jpg", holder1);
loadMovie("rooney.png", holder2);
//hide original holder mc
holder._alpha = 0;
holder1._alpha = 0;
holder2._alpha = 0;

//continually check to see if the img has been loaded yet, when yes run duplicateMC and stop checking
onEnterFrame = function(){
    if(holder1._width){
        delete this.onEnterFrame
        duplicateMC(holder, holder1, holder2);
    }
}

the problem is that i want this to be dynamic so all you do is add an image to the image array and it will automatically copy it to bitMapData, below is what i have come up with but it still doesn’t seem to work.


//load function passing in the mc holding the external image and the empty mc which it's going to be copied into.
function duplicateMC(mc1:MovieClip) {
    mcBMP = new BitmapData(mc1._width, mc1._height, true, 0x00000000);
    mcBMP.draw(mc1);
    mc1._visible = false;
    images.push(mcBMP)
    trace(mcBMP)
    if(images.length == imagess.length){
    //run slicing function passing it the newly created Bitmap object.
    startTransition(clips, images[index], speed, delay); 
    }
}

function loadImages(){
    for(i=0;i<imagess.length;i++){
        var t = homes.createEmptyMovieClip("holder"+i, i);
        loadMovie(imagess*, "holder"+i);
    }
}

loadImages();

//continually check to see if the img has been loaded yet, when yes run duplicateMC and stop checking
onEnterFrame = function(){
   if(homes["holder0"]._width){
       delete this.onEnterFrame;
        for(i=0;i<imagess.length;i++){
            var t = homes["holder" + i];
            duplicateMC(t)
        }
    }
}

cheers