Loading from XML

hi,
i have a main swf in which i load a couple of smaller swf’s. I took a finished script, so i want to modify it a bit.

the main swf now loads all of the external swf’s a then shows them. The problem is that i made a preloader for all of the smaller swf’s, main swf loads them, and they have a preloader until they load and show in main swf.

But now, main swf first loads all of the small swf’s and then shows them. So i have a blanks screen and then BOOM! all of the smaller swf’s

Here’s the ActionScript part, at the end there’s a part about " loader"

I want it to immediately show the smaller swf’s in the main swf, they have a preloader in them…and not so load them first and then shoe

Tnx in advance


// XML
menuItemsArray = new Array();
var menuXML:XML = new XML();
menuXML.ignoreWhite = true;
menuXML.onLoad = getData;
menuXML.load("menu.xml");
function getData(success:Boolean):Void {
    if(success){
        
        //itemNodes = menuXML.idMap["items"];
        itemNodes = this.childNodes[0].childNodes[1]
        how = itemNodes.childNodes.length + 1;
        node = itemNodes.childNodes;
        for(n=-1;n<how;n++){
            menuItemsArray.push({
                                name: node[n].attributes.name,
                                icon: node[n].attributes.icon,
                                link: node[n].attributes.link
                                })

            // if loop ends
            if(n==how-1){
                cantidad = how;
                //mainNodes = menuXML.idMap["config"];
                mainNodes = this.childNodes[0].childNodes[0]
                posX = mainNodes.attributes.posX;
                posY = mainNodes.attributes.posY;
                mainWidth = mainNodes.attributes.width;
                mainHeight = mainNodes.attributes.height;
                testPostitionAlpha = Number(mainNodes.attributes.testPostitionAlpha);
                passedVel = Number(mainNodes.attributes.scrollVel);
                if(mainWidth!="stage"){
                    mainWidth = Number(mainWidth);
                    } else {
                        mainWidth = Stage.width;
                        
                        }
                if(mainHeight!="stage"){
                    mainHeight = Number(mainHeight);
                    }else{
                        mainHeight = Stage.height/2;
                        }
                        
                if(posX!="stage"){
                    centroX = Number(posX);
                    } else {
                        centroX = Stage.width;
                        
                        }
                if(posY!="stage"){
                    centroY = Number(posY);
                    }else{
                        centroY = Stage.height/2;
                        }
                scaleSens = Number(mainNodes.attributes.scaleSens);
                thumbInitScale = Number(mainNodes.attributes.thumbInitScale);
                mouseSens = mainNodes.attributes.mouseSens;
                arrowPos = mainNodes.attributes.arrowPos;
                useBlur = mainNodes.attributes.useBlur;
                blurValue = Number(mainNodes.attributes.blurValue);
                presicionBlur = Number(mainNodes.attributes.presicionBlur);
                alphaReflex = Number(mainNodes.attributes.alphaReflex);
                alphaShine = Number(mainNodes.attributes.alphaShine);
                mainIconPath = mainNodes.attributes.mainIconPath;
                separacion = Number(mainNodes.attributes.thumbSeparation);
                magneta = Number(mainNodes.attributes.thumbMagnetize);
                XYScale = Number(mainNodes.attributes.thumbScale);
                thumbDuplicateSeparation = Number(mainNodes.attributes.thumbDuplicateSeparation);
                createMenuMain();
                blur = new flash.filters.BlurFilter(blurValue, blurValue, 1);
                }
            }
        }
    }
function chequeItem(item){
    if(currentItem != false)rechequeItem();
    currentItem = item;
    currentItem.enabled = false;
    _global.onReleaseThumb(item);
    fade(currentItem.arrows, 0, 50, 3)
    currentItem.arrows.filters = [blur];
    }
function rechequeItem(item2){
    fade(currentItem.arrows, 50, 0, 3)
    currentItem.enabled = true;
    currentItem = item2;
    }
// CREATING MENU
function createMenuMain(){
    this.attachMovie("btMask","bgAll",(cantidad+1)+this.getNextHighestDepth());
    this.attachMovie("btMask","bgAllTest",(cantidad+1)+this.getNextHighestDepth());
    this.createEmptyMovieClip("mC",this.getNextHighestDepth());
    bgAll._width = bgAllTest._width = mainWidth;
    bgAll._height = bgAllTest._height = mainHeight;
    bgAll._x = bgAllTest._x = Stage.width/2;
    bgAll._y = bgAllTest._y = Stage.height/2;
    bgAllTest._alpha = testPostitionAlpha;
    mC.setMask(bgAll)
    currentPos = 0;
    center = bgAllTest._width/2;
    factorDif = 1;
    vel = 100/passedVel;
    function creaBotones(){
        for(j=0;j<cantidad;j++){
            
            butons = mC.attachMovie("btn", "b"+j, j);
            dup = butons.createEmptyMovieClip("dup",j+butons.getNextHighestDepth());
            gradientMask = butons.attachMovie("gradient", "gradientMask", j+butons.getNextHighestDepth());
            gradientShine = butons.attachMovie("gradientReflex", "gradientReflex", j+butons.getNextHighestDepth());
            arrows = butons.attachMovie("arrow","arrow", j+butons.getNextHighestDepth());
            butons.arrows = arrows;
            butons.id = j;
            butons.gradientMask = gradientMask;
            butons.gradientShine = gradientShine;
            butons._alpha = gradientMask._alpha = gradientShine._alpha = butons.arrows._alpha = 0;
            butons.B_name = menuItemsArray[j].name;
            butons.B_icon = menuItemsArray[j].icon;
            butons.B_link = menuItemsArray[j].link;
            if(butons.B_icon){
                loadImages(mainIconPath+butons.B_icon, butons.icon);
                loadImages(mainIconPath+butons.B_icon, butons.dup, true, butons.id, cantidad);
            
            // buttons functions
            butons.onRelease = function(){
                chequeItem(this);
                }
            butons.onRollOver = function(){
                
                _global.onRollOverThumb(this)
                }
            butons.onRollOut = butons.onReleaseOutside = function(){
                
                _global.onRollOutThumb(this)
                }
            }
        }
    }
    creaBotones();
    function activaBotones(){
        var AnchMen = 0;
        for (var i = 0; i < cantidad; i++) {
            if(mouseSens<0){
                var xxm = mC["b" + i]._xmouse/mouseSens;
                var yym = mC["b" + i]._ymouse/mouseSens;
            } else {
                var xxm = mC["b" + i]._xmouse*mouseSens;
                var yym = mC["b" + i]._ymouse*mouseSens;
                }
            if(mouseSens == 0){
                var xxm = mC["b" + i]._xmouse;
                var yym = mC["b" + i]._ymouse;
                }
            
            var xm = Math.sqrt(xxm * xxm + yym * yym);
            if (xm < magneta) {
                mC["b" + i]._xscale = mC["b" + i]._yscale += (((20+XYScale - xm) - mC["b" + i]._yscale) / scaleSens);
                if(mC["b" + i]._xscale > 95){
                    mC["b" + i]._xscale = mC["b" + i]._yscale = 100
                    }
                if(useBlur=="true"){
                    blurConcept = Math.round(-mC["b" + i]._xscale-(XYScale-presicionBlur))/presicionBlur;
                    if(blurConcept<0){
                        blur.blurY = blur.blurX = 0;
                        }else{
                        blur.blurY = blur.blurX = blurConcept;
                        }
                }
            } else {
                mC["b" + i]._xscale = mC["b" + i]._yscale += (thumbInitScale - mC["b" + i]._yscale) / scaleSens;
                if(useBlur=="true"){
                    blur.blurY = blur.blurX = blurValue;
                }
            }
            AnchMen += mC["b" + i]._width;
            mC["b" + i].filters = [blur];
        }
        AnchMen += (cantidad - 1) * separacion;
        var xpos = Math.round((centroX - AnchMen) / 2) - mC["b" + 0]._width;
        xpos += Math.round((mC["b" + 0]._width + separacion) / 2);
        for (var i = 1; i < cantidad; i++) {
            x = i - 1;
            xpos += (mC["b" + x]._width / 2) + separacion + (mC["b" + i]._width / 2);
            mC["b" + i]._x = xpos;
            mC["b" + i]._y = centroY;
            
        }
        mC["b" + 0]._x = (mC["b" + 1]._x - mC["b" + 0]._width - separacion);
        mC["b" + 0]._y = centroY;

        // scroll
        if(mC._width > bgAll._width){
            dif = Math.round((bgAll._xmouse)/vel);
            difLeft = Math.round(mC._width - bgAll._width)/2;
            if(bgAllTest.hitTest(_xmouse,_ymouse)){
                if(dif<0){
                    factor = 1;
                    if(currentPos*factor > difLeft){
                        mC._x = mC._x;
                        currentPos = currentPos;
                        } else {
                            mC._x -= dif
                            currentPos -= dif;
                        }
                    }
                if(dif>0){
                    factor = -1;
                    if(currentPos*factor > difLeft){
                        mC._x = mC._x;
                        currentPos = currentPos;
                        } else {
                            mC._x -= dif
                            currentPos -= dif;
                        }
                    }
                }
            }
        updateAfterEvent();
    };
    var intervaloId:Number;
    intervaloId = setInterval(activaBotones, 10);
// loader
function loadImages(what, where, dup, id, how){
    var loadListener:Object = new Object();
    loadListener.onLoadStart = function(target_mc:MovieClip){
        }
    loadListener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number):Void {
    }
    loadListener.onLoadInit = function(target_mc:MovieClip):Void {
        where._alpha = 0;
        where._x = where._x - where._width/2;
        where._y = where._y - where._height/2;
        fade(where, 0, 100, 2);
        fade(where._parent, 0, 100, 2);
        if(arrowPos=="up"){
            where._parent.arrows._y = - where._height/2 - where._parent.arrows._height*2;
            }
        if(arrowPos=="down"){
            where._parent.arrows._rotation = 180
            where._parent.arrows._y = where._height/2 + where._parent.arrows._height*2;
            }
        if(dup){
            duplicate = where;
            gradientMask = where._parent.gradientMask;
            gradientShine = where._parent.gradientShine;
            gradientMask._alpha = gradientReflex._alpha = 0;
            duplicate._yscale = -100;
            duplicate.cacheAsBitmap = gradientMask.cacheAsBitmap = true;
            duplicate.setMask(gradientMask);
            duplicate._x = gradientShine._x = -where._width/2;
            duplicate._y = where._height + where._height/2+thumbDuplicateSeparation;
            gradientMask._width = gradientShine._width = where._width;
            gradientMask._height = gradientShine._height = where._height;
            gradientMask._x = where._x;
            gradientMask._y = where._y - where._height;
            gradientShine._y = -where._height/2;
            fade(gradientMask, 0, alphaReflex, 2);
            fade(gradientShine, 0, alphaShine, 2)
            }
    }
    loadListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
        integer = int((bytesLoaded*100)/bytesTotal);
    }
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(loadListener);
    mcLoader.loadClip(what, where);
    }
}