Load random pix

Hi all,

I have this site that loads random pix from different folders (not xml). What I would like but can’t seem to get to work, is for all the different images to be displayed before they are loaded again. If there for instance are 8 images in a folder I want those 8 images to be loaded – still randomly – before an image are loaded for the second time.

Heres the code I’m using:

[COLOR=“Blue”]*var maxVal = 8;
var oldVar = 8;
var newVar = 0;
var si = 0;

function getImage() {
newVar = Math.floor(Math.random() * maxVal);
if (newVar == oldVar) {
getImage();
} else {
oldVar = newVar;
container_mc.loadMovie (“bryghuset/foto” + newVar + “.jpg”);
container_mc._alpha = 0;
this.onEnterFrame = function () {
if (container_mc._width > 0) {
container_mc.onEnterFrame = fadeIn;
delete this.onEnterFrame;
}
}
}
}

function fadeIn () {
if (this._alpha <= 100) {
this._alpha += 5;
} else {
this._alpha = 100;
delete this.onEnterFrame;
si = setInterval(fadeOut, 2000);
movieclip
}
}

function fadeOut () {
clearInterval(si);
container_mc.onEnterFrame = function() {
if (this._alpha >= 0) {
this._alpha -= 5;
} else {
this._alpha = 0;
delete this.onEnterFrame;
getImage();
image
}
}
}

getImage();*[/COLOR]

If anyone could help out I would be very greatful.

/Simon