Premessa :
- Ho un swf principale, in AS3 (chiamato main.swf)
- Su main.swf un pulsante chiama un swf esterno, in AS2 (chiamato gallery.swf)
- gallery.swf usa images.xml per caricare foto al suo interno
- Tutti e 3 i files sono nello stesso dominio, nella root del sito
- Le foto al quale images.xml si rifersice sono in una cartella "gallery", dello stesso dominio
Il mio problema :
Quando dal main.swf clicco per far apparire gallery.swf, funziona tutto tranne che le immagini grandi non vengono caricate.
Vengono caricate solo: la prima foto (?), tutte le thumbnails e tutte le descrizioni, ma se provo a cliccare su qualsiasi thumbnails, la foto relativa non si carica, rimane sempre visualizzata la prima... ma invece la descrizione cambia.![]()
Se invece creo una pagina html dedicata solo a gallery.swf funziona tutto perfettamente.
Qualcuno mi saprebbe spiegare cosa sbaglio e come mai dal main.swf non funziona mentre da html sì?
Allego i codici:
Main.swf (AS3):
Gallery.swf (AS2):codice:function Photos(e:MouseEvent):void { var loader:Loader = new Loader(); var request:URLRequest = new URLRequest("http://www.miosito.com/gallery.swf"); loader.load(request); sectionArea2.addChild(loader); }
Struttura di images.xml :codice:function initGallery() { function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild; total = xmlNode.childNodes.length; for (i = 0; i < total; i++) { small_image[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; big_image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; description[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue; if (i == 0) { loadGImage(description[i], big_image[i]); } // end if ++total_images; } // end of for createSmall(); downloadButton._visible = true; } else { content = "file not loaded!"; } // end else if } // End of the function xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = loadXML; if (xml_file == undefined) { xml_file = "http://www.miosito.com/images.xml"; } // end if xmlData.load(xml_file); } // End of the function function createSmall() { smallContainer.createEmptyMovieClip("smallImageContainer", 10); var _loc4 = 0; var _loc3 = 0; for (var _loc2 = 0; _loc2 < small_image.length; ++_loc2) { smallContainer.imageContainer.attachMovie("smallImage", "smallImage_" + _loc2, 100 + _loc2); m = smallContainer.imageContainer["smallImage_" + _loc2]; m._x = _loc3 * 50; m._y = 0; m.imageContainer.loadMovie(small_image[_loc2], 100); m.iData = Array(); m.iData.big = big_image[_loc2]; m.iData.title = description[_loc2]; ++_loc3; } // end of for smallImageContainer._x = 5; smallImageContainer._y = 0; } // End of the function function loadGImage(title, bigImgURL) { bigImage.imageContainer.loadMovie(bigImgURL, 100); bigImage.imageContainer._x = 0; bigImage.imageContainer._y = 0; title.text = title; downloadButton.onRelease = function () { getURL(bigImgURL, "_blank"); }; } // End of the function function goFullScreen() { Stage.displayState = "fullScreen"; } // End of the function function exitFullScreen() { Stage.displayState = "normal"; } // End of the function function menuHandler(obj, menuObj) { if (Stage.displayState == "normal") { menuObj.customItems[0].enabled = true; menuObj.customItems[1].enabled = false; } else { menuObj.customItems[0].enabled = false; menuObj.customItems[1].enabled = true; } // end else if } // End of the function description = new Array(); small_image = new Array(); big_image = new Array(); total_images = 0; initGallery(); var fullscreenCM = new ContextMenu(menuHandler); fullscreenCM.hideBuiltInItems(); var fs = new ContextMenuItem("Go Full Screen", goFullScreen); fullscreenCM.customItems.push(fs); var xfs = new ContextMenuItem("Exit Full Screen", exitFullScreen); fullscreenCM.customItems.push(xfs); menu = fullscreenCM; downloadButton._visible = false;
Grazie a tutti quelli che potranno darmi una mano... non riesco a cavarne le gambecodice:<?xml version="1.0" encoding="utf-8" standalone="yes"?> <images> <pic> <image>gallery/1.jpg</image> <thumbnail>gallery/s1.jpg</thumbnail> <caption>descrizione 1</caption> </pic> <pic> <image>gallery/2.jpg</image> <thumbnail>gallery/s2.jpg</thumbnail> <caption>descrizione 2</caption> </pic> <pic> <image>gallery/3.jpg</image> <thumbnail>gallery/s3.jpg</thumbnail> <caption>descrizione 3</caption> </pic> </images>![]()
![]()

Rispondi quotando