preloader til slideshow
Jeg har før rodet med dette emne, se http://www.eksperten.dk/spm/384072Scriptet nedenfor (tak til Pyroman) loader X antal billeder. Disse billeder kører derefter i et slideshow med "overblænding".
Jeg vil imidlertid gerne have at alle billeder bliver loaded inden slideshowet går igang. Altså en preloader, gerne med en procentangivelse.
Men jeg er kørt fast....:-(
Er der nogen der har et bud på dette?
///Boe
--------------------------------------------------------------
antalpics = 30;
waiting = false;
currentAlpha = 100;
nextAlpha = 0;
interval = 2;
currentPic = 0;
//kan ændres til 1
step = 4;
//-------------------
for (i=1; i<=antalpics; i++) {
_root.attachMovie("pic", "pic"+i, i);
_root["pic"+i].loadMovie(../i+".jpg");
_root["pic"+i]._alpha = 0;
_root["pic"+i]._x = 0;
_root["pic"+i]._x = 0;
}
//pic1._alpha = 100;
_root.onEnterFrame = function() {
if (currentAlpha>=100) {
if (!waiting) {
startTime = Math.round(getTimer()/1000);
waiting = true;
} else if (waiting && Math.round(getTimer()/1000)>=startTime+interval) {
waiting = false;
currentAlpha -= step;
nextAlpha += step;
}
} else if (currentAlpha<=0) {
currentPic++;
if (currentPic>antalpics) {
currentPic = 1;
}
currentAlpha = 100;
nextAlpha = 0;
} else {
currentAlpha -= step;
nextAlpha += step;
}
if (currentPic == antalpics) {
_root["pic"+currentpic]._alpha = currentAlpha;
_root.pic1._alpha = nextAlpha;
} else {
_root["pic"+currentPic]._alpha = currentAlpha;
_root["pic"+(currentPic+1)]._alpha = nextAlpha;
}
};
