Salve ragazzi buongiorno. Premetto che non sono molto esperto di Action Script e sto dando una mano al collega.
Ho un file che mi dovrebbe caricare come sfondo delle immagini tramite file XML solo che non me le mostra. Dall' output non ho nessun errore relativo al caricamento del file XML.
Ecco il codice del file flash:
Qiesto è il file XML:codice:function parseXML(sucess) { if (sucess) { maxImages = xml2as.images[0].image.length - 1; preload = xml2as.images[0].preload; speed = Number(xml2as.images[0].speed); if (!xml2as.images[0].speed) { speed = 2; } // end if if (preload) { preloadImages(); } else { loadImages(); } // end else if } else { trace ("Error loading XML!"); } // end else if } // End of the function function preloadImages() { for (var _loc1 = 0; _loc1 < preload; ++_loc1) { var _loc2 = mainTimeline.imagesHolder.createEmptyMovieClip("clip_" + _loc1, mainTimeline.imagesHolder.getNextHighestDepth()); var _loc3 = String(xml2as.images[0].folderpath) + String(xml2as.images[0].image[_loc1].url); loadQueue.addToQueue(_loc3, _loc2, false, false); } // end of for loadQueue.startLoad(); } // End of the function function loadImages() { if (preload) { for (var _loc1 = preload; _loc1 < xml2as.images[0].image.length; ++_loc1) { var _loc2 = mainTimeline.imagesHolder.createEmptyMovieClip("clip_" + _loc1, mainTimeline.imagesHolder.getNextHighestDepth()); var _loc3 = String(xml2as.images[0].folderpath) + String(xml2as.images[0].image[_loc1].url); loadQueue2.addToQueue(_loc3, _loc2, false, false); } // end of for } else { for (var _loc1 = 0; _loc1 < xml2as.images[0].image.length; ++_loc1) { _loc2 = mainTimeline.imagesHolder.createEmptyMovieClip("clip_" + _loc1, mainTimeline.imagesHolder.getNextHighestDepth()); _loc3 = String(xml2as.images[0].folderpath) + String(xml2as.images[0].image[_loc1].url); loadQueue2.addToQueue(_loc3, _loc2, false, false); } // end of for } // end else if loadQueue2.startLoad(); } // End of the function function startAnimation() { var _loc1 = mainTimeline.imagesHolder["clip_" + imageIterator]; var _loc2 = new Object(); _loc2.y = 0; _loc2.x = 0; _loc1._x = _loc2.x; _loc1._y = _loc2.y; _loc1._alpha = 0; _loc1._visible = true; var _loc5 = getOldImageIterator(); var _loc3 = mainTimeline.imagesHolder["clip_" + _loc5]; var _loc4 = Number(xml2as.images[0].image[imageIterator].time); if (!_loc1.loaded) { trace ("clip not yet loaded , come back later"); setTimeout(mainTimeline, "startAnimation", 400); return; } // end if caurina.transitions.Tweener.addTween(_loc3, {delay: 2.000000E-001, time: speed, _alpha: 0, transition: tweenerTransition, onComplete: hideMc, onCompleteParams: [_loc3]}); caurina.transitions.Tweener.addTween(_loc1, {delay: 2.000000E-001, time: speed, _alpha: 100, transition: tweenerTransition}); caurina.transitions.Tweener.addCaller(mainTimeline, {delay: speed, time: _loc4, count: 1, onComplete: startAnimation}); increaseIterator(); } // End of the function function showMc(mc) { mc._visible = true; } // End of the function function hideMc(mc) { mc._visible = false; } // End of the function function chooseRandomDir() { var _loc1 = Math.floor(Math.random() * directionArray.length); return (directionArray[_loc1]); } // End of the function function increaseIterator() { ++imageIterator; if (imageIterator > maxImages) { imageIterator = 0; } // end if } // End of the function function setBgSize(mc) { var _loc2 = mc._width / mc._height; var _loc3 = Stage.width / Stage.height; if (_loc3 >= _loc2) { mc._width = Stage.width; mc._height = Stage.width / _loc2; } else { mc._height = Stage.height; mc._width = Stage.height * _loc2; } // end else if } // End of the function function getOldImageIterator() { var _loc1 = imageIterator; --_loc1; if (_loc1 < 0 && firstTimeLoaded != true) { _loc1 = maxImages; } // end if firstTimeLoaded = false; return (_loc1); } // End of the function caurina.transitions.properties.DisplayShortcuts.init(); Stage.align = "TL"; Stage.scaleMode = "noScale"; var xml2as = new Object(); var xmlURL = "images.xml"; gs.dataTransfer.XMLParser.load(xmlURL, parseXML, xml2as); this._lockroot = true; mainTimeline = this; loader._x = Stage.width / 2 - loader._width / 2; loader._y = Stage.height / 2 - loader._height / 2; var imageIterator = 0; var maxImages = 0; var tweenerTransition = "easeInoutQuint"; var speed; var time; var preload = undefined; var loadQueue = new com.dsky.QueueManager(); var loadL = new Object(); loadL.onQueueProgress = function (info) { mainTimeline.loader.bar._xscale = info.percent; mainTimeline.loader.text2MC.loadText.text = Math.round(info.percent) + "%"; }; loadL.onLoadStart = function (target) { target._visible = false; target._x = Stage.width; }; loadL.onLoadInit = function (target) { target.loaded = true; target._visible = false; target._alpha = 0; setBgSize(target); }; loadL.onAllLoaded = function (info) { loadQueue.clearQueue(); caurina.transitions.Tweener.addTween(loader, {_autoAlpha: 0, _y: loader._y + 40, time: 1, transition: "easeOutExpo"}); if (preload) { startAnimation(); loadImages(); } // end if }; loadQueue.addListener(loadL); var loadQueue2 = new com.dsky.QueueManager(); var queueL2 = new Object(); loadQueue2.addListener(queueL2); queueL2.onLoadStart = function (target) { target._visible = false; target._x = Stage.width; }; queueL2.onLoadInit = function (target) { target.loaded = true; target._visible = false; target._alpha = 0; setBgSize(target); target._x = Stage.width; }; queueL2.onQueueProgress = function (info) { mainTimeline.loader.bar._xscale = info.percent; }; queueL2.onAllLoaded = function () { loadQueue2.clearQueue(); if (preload) { return; } // end if caurina.transitions.Tweener.addTween(loader, {_autoAlpha: 0, time: 1, _y: loader._y + 40, transition: "easeOutExpo"}); startAnimation(); }; var firstTimeLoaded = true; var stageL = new Object(); stageL.onResize = function () { for (var _loc1 = 0; _loc1 < xml2as.images[0].image.length; ++_loc1) { var _loc2 = mainTimeline.imagesHolder["clip_" + _loc1]; setBgSize(_loc2); } // end of for com.dsky.Align.center(loader); }; Stage.addListener(stageL); //infoClip.fullButt.onPress = function () //{ // if (Stage.displayState == "normal") //{ // Stage.displayState = "fullScreen"; //} //else //{ // Stage.displayState = "normal"; //} // end else if //};
Ho controllato i percorsi e sono corretti, errori quando creo l'swf non ne ho.codice:<?xml version="1.0" encoding="utf-8" ?> - <data> - <images folderpath="images/" preload="3" speed="5"> <image url="immagine1.jpg" time="3" /> <image url="immagine2.jpg" time="3" /> <image url="immagine3.jpg" time="3" /> <image url="immagine4.jpg" time="3" /> <image url="immagine5.jpg" time="3" /> <image url="immagine6.jpg" time="3" /> <image url="immagine7.jpg" time="3" /> <image url="immagine8.jpg" time="3" /> </images> </data>
Da cosa potrebbe dipendere?
:master:

Rispondi quotando