Ciao a tutti,
ho un filmato che carica un xml, dal quale prendo il path di circa 80 immagini: praticamente è uno slideshow tra queste immagini. Sto cercando di fare un preload per ciascuna di queste immagini, ma nella finestra di output dice che cade in un loop infinito. Qualcunoo mi può aiutare?
Ciao
L.
codice:
slides_xml = new XML();
slides_xml.load("slides.xml");
slides_xml.onLoad = startSlideShow;
slides_xml.ignoreWhite = true;
_global.intervallo = 0;
attesa = 2000; //2 sec
// Show the first slide and intialize variables
function startSlideShow(success) {
if (success == true) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
updateSlide(firstSlideNode);
}
}
function preload (targetClip) {
ImgBytesLoaded = _root.targetClip.getBytesLoaded();
ImgBytesTotal = _root.targetClip.getBytesTotal();
if (ImgBytesLoaded >= ImgBytesTotal){
return(targetClip);
} else {
preload();
trace ("preloading again");
}
return(targetClip);
}
// Updates the current slide with new image and text
function updateSlide(newSlideNode) {
imagePath = newSlideNode.attributes.jpegURL;
slideText = newSlideNode.firstChild.nodeValue;
loadMovie(imagePath, targetClip);
preload (targetClip);
//Alpha
targetClip._alpha = 0;
_root.onEnterFrame = function() {
if(targetClip._alpha >= 100){
break;
} else {
targetClip._alpha += 5;
}
}
_global.intervallo = setInterval(pausa,attesa);
trace ("intervallo" + _global.intervallo);
}
function pausa() {
nextSlideNode = currentSlideNode.nextSibling;
clearInterval(_global.intervallo);
if (nextSlideNode != null) {
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
} else {
slides_xml.onLoad = startSlideShow;
slides_xml.load("slides.xml");
}
}