sai quale è il problema che il COMBOBOX non mi aggiorna l'XML.. o provato cosi
questo è lo script principale che carica l'xml
codice:
function Gallery(variabile)
{
while(_root.small_image.length > 0) {
_root.small_image.pop();
}
while(_root.m.iData.length > 0) {
_root.m.iData.pop();
}
_root.total_images = 0;
_root.description = new Array();
_root.small_image = new Array();
_root.big_image = new Array();
_root.total_images = 0;
function loadXML(loaded)
{
if (loaded)
{
xmlNode = this.firstChild;
total = xmlNode.childNodes.length;
for (i = 0; i < total; i++)
{
_root.small_image[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
_root.big_image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
_root.description[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
if (i == 0)
{
_root.loadGImage(_root.description[i], _root.big_image[i]);
} // end if
++_root.total_images;
} // end of for
Small();
_root.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 (_root.xml_file == undefined)
{
_root.xml_file = variabile;
} // end if
xmlData.load(xml_file+"?r="+Math.random()*999999);
} // End of the function
function Small()
{
_root.smallContainer.createEmptyMovieClip("smallImageContainer", 10);
var _loc4 = 0;
var _loc3 = 0;
for (var _loc2 = 0; _loc2 < _root.small_image.length; ++_loc2)
{
_root.smallContainer.imageContainer.attachMovie("smallImage", "smallImage_" + _loc2, 100 + _loc2);
m = _root.smallContainer.imageContainer["smallImage_" + _loc2];
m._x = _loc3 * 50;
m._y = 0;
m.imageContainer.loadMovie(_root.small_image[_loc2], 100);
m.iData = Array();
m.iData.big = _root.big_image[_loc2];
m.iData.title = _root.description[_loc2];
++_loc3;
} // end of for
_root.smallImageContainer._x = 5;
_root.smallImageContainer._y = 0;
} // End of the function
e
codice:
_root.description = new Array();
_root.small_image = new Array();
_root.big_image = new Array();
_root.total_images = 0;
//_root.xml_file = "images.xml";
variabile1="file.xml?r="+Math.random()*999999;
Gallery(variabile1);
con il combobox che faccio:
// Crea un oggetto listener.
var cbListener:Object = new Object();
// Crea una funzione di gestione degli eventi.
cbListener.change = function (evt_obj:Object) {
trace("Currently selected item is: " + evt_obj.target.selectedItem.data);
Gallery(evt_obj.target.selectedItem.data);
}
// Aggiunge un listener di eventi.
comboBox.addEventListener("change", cbListener);
lo script funziona, ma non mi carica le immagini passate con il file XML che viene richiamato dal combobox.... ma carica sempre quelle del primo file RICHIAMATO dal COMBOBOX, come si potrebbe risolvere? credo che sia un problema di svuotare gli array nel flash... ma non ci ho capito granché...
grazie