Preload all xml content

Hello!

I need some ideas on how to preload all content in a xml list into my flash project.

This is how I load the xml content today:

function xmlLoaded2(event:Event):void
{
    xml2 = XML(event.target.data);
    xmlList2 = xml2.children();
    for(i = 0; i < xmlList2.length(); i++)
    {
        
        imageLoader2.load(new URLRequest(xmlList2*.attribute("source")));
        trace("number of pictures:"+i);
vaxla();



vaxla and the onComplete function are the functions that adds the current media to the stage they looks like this:

    

if (j <= i){
        
        imageLoader2.load(new URLRequest(xmlList2[j].attribute("source")));
                imageLoader2.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
           imageLoader2.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler, false, 0, true);
        
        addChild(imageLoader2);
        
        loadText();
        goHeadings();
    
        
        trace("j="+j);
        trace("i="+i);
        
        
    }
    else{
        
        j = 0;
        imageLoader2.load(new URLRequest(xmlList2[j].attribute("source")));
        addChild(imageLoader2);
        loadText();
        trace("j="+j);
        trace("i="+i);
        
    }

onComplete looks like this:


function onComplete(event:Event):void {
    progressTxt.text = "";
    //trace("count is " +count+ " of " +lastImage);

    
        mc_loader.addChild(imageLoader2);

i got this preloader function today but it only preloads the current media:


function progressHandler(event:ProgressEvent):void {
    var percent:Number = 0; 
    var loaded:Number = 0;
    var total:Number = 0;
    
    
       loaded += imageLoader2.contentLoaderInfo.bytesLoaded;
    total += imageLoader2.contentLoaderInfo.bytesTotal;
    percent = loaded / total;
    //LoaderBarMC.progressBar.scaleX = percent;  //scaleX is a value from 0.0 to 1.0
    
    //progressTxt.text = "Loading"+loaded()"of"+total();
    progressTxt.text = Math.floor(100 * percent) + "%";
    trace("bytesLoaded=" + loaded + " bytesTotal=" + total);
}



so any ideas how i can load everything at the start? :slight_smile:

kind regards
rob