Will my code work? so confused

will this code work? basically, what i’m attempting to achieve is this:
I have 3 boxes, in it, I create 2 empty MC’s each… Then I want to load in an image into holder1 for each, then after a few seconds, load in another image into holder2, and when it is loaded, transition the image(fadeIn, fadeOut).
(I hope I’m making sense, the code is pretty rough, I’m just so confused. I just need a nudge at the right direction. Any help is greatly appreciated. :slight_smile: )


stop();

var ROOT = this;
var num1:Number;
var num2:Number;
var num3:Number;
var currentDisplay:Number = 1;
var holder1MCL:MovieClipLoader = new MovieClipLoader();
var holder2MCL:MovieClipLoader = new MovieClipLoader();
var holder1Lis:Object = new Object();
var holder2Lis:Object = new Object();

holder1MCL.addListener(holder1Lis);
holder2MCL.addListener(holder2Lis);


for (i=0; i<3; i++) {
    //create empty movieclips
    this.all.images["image"+i].createEmptyMovieClip("holder1",10);
    this.all.images["image"+i].createEmptyMovieClip("holder2",20);
    //assign function to empty mc's
    this.all.images["image"+i].onEnterFrame = function() {
        changeImg(this.holder1,this.holder2);
    };
}

function changeImg(_holder1:MovieClip, _holder2:MovieClip) {
    if (ROOT.currentDisplay == 1) {
        holder2MCL.loadClip(nextImg,_holder2);
        holder2Lis.onLoadComplete = function() {
            _holder1.onEnterFrame = fadeOut();
            _holder2.onEnterFrame = fadeIn();
        };
    } else if (ROOT.currentDisplay == 2) {
        holder1MCL.loadClip(nextImg,_holder1);
        holder1Lis.onLoadComplete = function() {
            _holder2.onEnterFrame = fadeOut();
            _holder1.onEnterFrame = fadeIn();
        };
    }
}
//just some function, still figuring out what to do :-P
function genRand() {
    num1 = 4+Math.round(Math.random()*10);
    num2 = 4+Math.round(Math.random()*10);
    num3 = 4+Math.round(Math.random()*10);
    if (num1 == num2 || num2 == num3 || num1 == num3) {
        num1 = 4+Math.round(Math.random()*10);
        num2 = 4+Math.round(Math.random()*10);
        num3 = 4+Math.round(Math.random()*10);
    }
}
//transition functions
function fadeIn() {
    this._alpha += 10;
}
function fadeOut() {
    this._alpha -= 10;
}