Looking 4 different way to load xml

Hi

i was creating my portfolio using xml gallery script from this site. the thing is that it loads one picture at a the with a preloader between each load.

is there a way to load the first image and keep loading the rest so there will be only one loading time ?

thanx

here is my action script:


stop();

function loadXML(loaded) {
    if (loaded) {
        xmlNode = this.firstChild;
        image = [];
        description = [];
        thumbnails = [];
        _global.total = xmlNode.childNodes.length;
        for (i=0; i<total; i++) {
            image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
            description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
            thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
            thumbnailer(i);
        }
        firstImage();
    } else {
        trace("file not loaded!");
    }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad =loadXML;
xmlData.load("graphic-p.xml");

/////////Load First Image Function///////////////////////////////////////////////

function firstImage() {
    if (loaded == filesize) {
        picture._alpha = 0;
        picture.loadMovie(image[0], 1);
        desc_txt.text = description[0];
    }
}

/////////Image Preloader Function//////////////////////////////////////////////////////

p = 0;
this.onEnterFrame = function() {
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
        preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
        preloader._visible = false;
        if (picture._alpha<100) {
            picture._alpha += 10;
        }
    }
};

//////////Load clicked thumbnail Image Function////////////////////////////////////////////////

function callImage() {
        if (loaded == filesize) {
            picture._alpha = 0;
            picture.loadMovie(image[p], 1);
            desc_txt.text = description[p];
        }
}

//////////Thumbnail maker///////////////////////////////

function thumbnailer(k){
    loaded_counter=0;
    total_thumbs = _global.total;
    var container = thumbnail_mc.createEmptyMovieClip("th"+k,thumbnail_mc.getNextHighestDepth());
    container._visible=false;
    container._alpha=0;
    var image = container.createEmptyMovieClip("img", container.getNextHighestDepth());
    tlistener = new Object();
    tlistener.onLoadInit = function(target_mc) {
        target_mc.pictureValue = k;
        target_mc.onRollOver = function() {
            p = this.pictureValue;
            callImage();
            this._alpha = 50;
        };
        target_mc.onRollOut = function() {
            this._alpha = 100;
        };
        loaded_counter++;
        counting_txt = loaded_counter;
        if(loaded_counter==total_thumbs){
            grid_maker_01();
        }
    };
    image_mcl = new MovieClipLoader();
    image_mcl.addListener(tlistener);
    image_mcl.loadClip(thumbnails[k], "thumbnail_mc.th"+k+".img");
}

///////////Layout Functions/////////////////////////////////////////////////////////////////////

MovieClip.prototype.grid_maker_01=function(f){
    num=0;
    col=3;
    row=8;
    scale=100;
    space=8;
    for (j=0;j<row;j++){
    for (l=0;l<col;l++){
            if(num<_global.total){
            with(eval("this.thumbnail_mc.th"+num)){
                _x=((_width+space)*scale/100)*l;
                _y=((_height+space)*scale/100)*j;
                _xscale=_yscale=scale;
                _visible=true;
            }
            num++;
            }
        }
    }
    this.cascader();
}

//////////////////////////////////////////////////////////////////////////////////

MovieClip.prototype.cascader=function(){
    inter=100;
    c=0;
    delayed_fade=function(){
        if (c<_global.total){
            with(eval("this.thumbnail_mc.th"+c)){
                fadein();
            }
            c++;
        }else{
            main_menu.boton_reset._visible=true;
            clearInterval(delay);
        }
    }
    delay=setInterval(delayed_fade,inter);
}

///////////////////////////////////////////////////////////////////////////////

MovieClip.prototype.fadein=function(){
    this.onEnterFrame=function(){
        if (this._alpha<100){        
            this._alpha=this._alpha+5;
        }else{
            this._alpha=100;
            delete this.onEnterFrame;
        }
    }
}

///////////////////////////////////////////////////////////////////////////////////////


[LEFT]
[/LEFT]

You can load pictures on a hidden movieclip, and then load again the same urls on a visible movieclip. This way the second time you load them, you do it from the cache and there won’t be no waiting time.

but i am using xml. only when you rollover the thumbnail the image is loaded.
it is a multi page gallery and it will be a mess to break all the images apart, that is what the xml gallery is there for ???

is there any way to do it through the AS ?

AVI

I don’t follow garbled english, I may write it :stuck_out_tongue: :stare:

you want to load all images and have one load bar for all?

if you want the first to load, then the load bar to keep going untill the rest have loaded

if(progress of item 1 >= 90){
load all other items.
loadbar._xscale = progress of all items/ number of items.
} else{
loadbar._xscale = progress of loading item 1 / number of items
}

you would have to make sure that undefined value you get is returned as 0 to ensure it doesn’t muck up