preloading af eksterne jpeg's
Jeg er ved at brygge et slideshow med JPEG billeder sammen. Billederne bliver hentet som eksterne JPEG's - de ligger altså ikke i scriptet.Jeg kunne godt tænke mig at alle billeder blev hentet før slideshowet sætter i gang.
Er det muligt at lave en preloader til dette script?
------------------------------------
Her er scriptet:
antalpics = 3;
waiting = false;
currentAlpha = 100;
nextAlpha = 0;
interval = 3;
currentPic = 0;
//kan ændres til 1
step = 4;
//-------------------
for (i=1; i<=antalpics; i++) {
_root.attachMovie("pic", "pic"+i, i);
_root["pic"+i].loadMovie("http://www.xxx.dk/xx/xxx/"+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;
}
};
