sfondo1 e sfondo2 sono 2 mc vuoti nel movie principale con quel nome istanza e le foto si devono chiamare in sequenza 1.jpg-2.jpg ecc...

codice:
maxX=200
maxY=200

tempo = getTimer();
pausa = 3000;	
fadeout = false;
numvar=1
miaclip = +numvar+".jpg";



loadMovie (miaclip, sfondo1);
loadMovie (miaclip, sfondo2);

preload = function () {
   if (sfondo1.getBytesLoaded() == sfondo1.getBytesTotal() && _root.back1.getBytesTotal()>1024) {
	     clearInterval(preloadID);
    } else {
	//_root.barra_mc._xscale = _root.back1.getBytesLoaded()/_root.back1.getBytesTotal()*100;
	    }
};
preloadID = setInterval(preload, 100);

this.onEnterFrame = function() {
	if (getTimer() - this.tempo >= this.pausa) {
		this.tempo = getTimer();
		this.fadeout = true;
		// ... istruzioni per numero random ...
		this.numvar = Math.round(Math.random()*5);			if (this.numvar<1) {
			this.numvar = 1;				}
		if(this.numvar<=9){this.miaclip = +this.numvar+".jpg";}
		else{this.miaclip = +this.numvar+".jpg";}
	    
		loadMovie (miaclip, this.sfondo2);
		preload = function () {
		//_root.barra_mc._xscale = 0	
	    if (this.sfondo2.getBytesLoaded() == this.sfondo2.getBytesTotal() && _root.back2.getBytesTotal()>1024) {
		    clearInterval(preloadID);
	    } else {
		//_root.barra_mc._xscale = _root.back2.getBytesLoaded()/_root.back2.getBytesTotal()*100;
	    }
    };
    preloadID = setInterval(preload, 100);
	}
	if (fadeout) {
		if (this.sfondo1._alpha > 0) {
			this.sfondo1._alpha -= 5;
		} else {
			this.fadeout = false;
			loadMovie (miaclip, this.sfondo1);
		}
	} else {
		this.sfondo1._alpha = 99;
	}
}