1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| var gallery_xml:XML = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success:Boolean) {
try {
/* if you are able to successfully load and parse the gallery from a remote XML file,
parse out the image names and add them to an array. */
if (success) {
var images:Array = this.firstChild.childNodes;
var gallery_array:Array = new Array();
for (var i = 0; i<images.length; i++) {
gallery_array.push({src:images[i].firstChild.nodeValue});
}
/* call the displayGallery function which handles loading in each
of the gallery images and placing them on the Stage. */
displayGallery(gallery_array);
} else {
throw new Error("Unable to parse XML");
}
} catch (e_err:Error) {
trace(e_err.message);
} finally {
delete this;
}
};
// load the gallery.xml file from the current directory.
gallery_xml.load("gallery_tween.xml"); |
Partager