External SWF Preloader in Actionscript 3

Hi all,
This is my first post here. Sorry before if there are already similar threads around but honestly I cannot apply it correctly for my case.

I have one main movie (index.php) this main movie like an accordion menu is it has a functions to call 5 external movies using actionscript like this:


loadXML("menu.xml"); //load the xml

function loadXML(Uri:String):void {
    xmlLoader = new URLLoader();
    xmlLoader.addEventListener(Event.COMPLETE, onComplete);
    xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, onError);
    xmlLoader.load(new URLRequest(Uri));
}

function onError(evt:ErrorEvent):void {
    trace("cannot load xml file");
}

function onComplete(evt:Event):void {
    MENU_ARRAY = prepareMenu(xmlLoader.data.toString()); //read and load xml into array, by parsing it using prepareMenu
    placeItemsOnStage(); //place all required items on stage.
}

function prepareMenu (XMLData:String):Array{
    var menuXML:XML = new XML(XMLData); //make sure it cames in XML
    menuXML.ignoreWhitespace = true; //just in case
    var XMLItems = menuXML.descendants("item"); //get XML item's entrys
    var itemsArray:Array = new Array(); //load all items into an array
    var itemObj:Object;

    for(var i in XMLItems){
        itemObj = new Object();
        itemObj.Iid = XMLItems*.@Iid;
        itemObj.Ititle = XMLItems*.@Ititle;
        itemObj.IcontentType = XMLItems*.@IcontentType;
        itemObj.IcontentData = XMLItems*.@IcontentData;
        itemObj.Icolor = XMLItems*.@Icolor;
        itemObj.Iimage = XMLItems*.@Iimage;
        itemObj.itemID = "menu"+i;
        itemsArray.push(itemObj);
    }
    
    OPENED_MENU = menuXML.@menuOpen; //get menu for open.
     MOVE_ON_MOUSE_OVER=(menuXML.@moveOnMouseOver.toString() == "true" ? true : false); //get the option for load or not mouseOver open
    return itemsArray;
}

function placeItemsOnStage():void {
    var pos:Number=0;
for(var c: int = 0; c < MENU_ARRAY.length; c++) {
var it:menuItem = new menuItem;

if(String(MENU_ARRAY[c].IcontentType)=="image/swf")    { //check the content and load things accordint to it
            var ldr:Loader = new Loader();
            ldr.x = 25;
            ldr.y = -14.75;
            it.addChild(ldr);

            if(MENU_ARRAY[c].IcontentData.toString() != "")
                ldr.load(new URLRequest(MENU_ARRAY[c].IcontentData.toString()));

        }
}
}


I have read somewhere, that on of the approach is by treating the external movies as the movieclip in the main movie so that it can be preloaded together.

I can create the preloader but whenever I simulate it, it seems the preloader doesn’t preload those 5 external movies but only the main movie (worked well). As the result, the main movie contains several blank space where the external movies used to be.

If there’s somebody can help me to share of solve, I will give him/her kudos :smiley:

Sorry for my limited knowledge for this thread. Thank you guys for your attention and appreciation.