Return to Snippet

Revision: 9994
at December 6, 2008 16:51 by garretjames


Updated Code
gallery = "xml/"+ _root.xmlFileVariable + ".xml";
photo = 0;
Photos_xml = new XML();
Photos_xml.onLoad = loadPhotos;
Photos_xml.load(gallery);
Photos_xml.ignoreWhite = true;

function loadPhotos(success) {
	if (success == true) {
		rootNodePhotos = Photos_xml.firstChild;
		totalPhotos = rootNodePhotos.childNodes.length;
		currentNodePhotos = rootNodePhotos.firstChild;                             
		descriptions = new Array(totalPhotos);
		PhotoUrl = new Array(totalPhotos);
		BigUrl = new Array(totalPhotos);
		links = new Array(totalPhotos);
		titles = new Array(totalPhotos);
		price = new Array(totalPhotos);
		swf = new Array(totalPhotos);
		dx = 0;
		for (i=0; i < totalPhotos; i++) { 
			descriptions[i] = currentNodePhotos.firstChild.nodeValue;
			PhotoUrl[i] = currentNodePhotos.attributes.PhotoUrl;
			BigUrl[i] = currentNodePhotos.attributes.BigUrl;
			links[i] = currentNodePhotos.attributes.link;
			titles[i] = currentNodePhotos.attributes.title;
			price[i] = currentNodePhotos.attributes.price;
			swf[i] = currentNodePhotos.attributes.swf;
			_root.images.attachMovie("photo","img"+i,i+300);
			_root.images["img"+i]._x = dx;
			_root.images["img"+i]._y = 0;
			_root.images["img"+i].k = i;
			dx = dx + 330;			
			_root.images["img"+i].Url = PhotoUrl[i];
			_root.images["img"+i].BigUrl = BigUrl[i];
			_root.images["img"+i].link = links[i];
			_root.images["img"+i].title = titles[i];
			_root.images["img"+i].swf = swf[i];
			if (!price[i]){
				_root.images["img"+i].price = "";
			}else{
				_root.images["img"+i].price = price[i];
			}
			currentNodePhotos = currentNodePhotos.nextSibling;
		}
		play();
		_root.Move = true;
	}
}

Revision: 9993
at December 2, 2008 17:58 by garretjames


Initial Code
gallery = "xml/"+ _root.gallerySelected + ".xml";
photo = 0;
Photos_xml = new XML();
Photos_xml.onLoad = loadPhotos;
Photos_xml.load(gallery);
Photos_xml.ignoreWhite = true;

function loadPhotos(success) {
	if (success == true) {
		rootNodePhotos = Photos_xml.firstChild;
		totalPhotos = rootNodePhotos.childNodes.length;
		currentNodePhotos = rootNodePhotos.firstChild;                             
		descriptions = new Array(totalPhotos);
		PhotoUrl = new Array(totalPhotos);
		BigUrl = new Array(totalPhotos);
		links = new Array(totalPhotos);
		titles = new Array(totalPhotos);
		price = new Array(totalPhotos);
		swf = new Array(totalPhotos);
		dx = 0;
		for (i=0; i < totalPhotos; i++) { 
			descriptions[i] = currentNodePhotos.firstChild.nodeValue;
			PhotoUrl[i] = currentNodePhotos.attributes.PhotoUrl;
			BigUrl[i] = currentNodePhotos.attributes.BigUrl;
			links[i] = currentNodePhotos.attributes.link;
			titles[i] = currentNodePhotos.attributes.title;
			price[i] = currentNodePhotos.attributes.price;
			swf[i] = currentNodePhotos.attributes.swf;
			_root.images.attachMovie("photo","img"+i,i+300);
			_root.images["img"+i]._x = dx;
			_root.images["img"+i]._y = 0;
			_root.images["img"+i].k = i;
			dx = dx + 330;			
			_root.images["img"+i].Url = PhotoUrl[i];
			_root.images["img"+i].BigUrl = BigUrl[i];
			_root.images["img"+i].link = links[i];
			_root.images["img"+i].title = titles[i];
			_root.images["img"+i].swf = swf[i];
			//Code edit by Garret to display nothing if their is no defined price
			if (!price[i]){
				_root.images["img"+i].price = "";
			}else{
				_root.images["img"+i].price = price[i];
			}
			//End Code edit
			currentNodePhotos = currentNodePhotos.nextSibling;
		}
		play();
		_root.Move = true;
	}
}

Initial URL

                                

Initial Description

                                

Initial Title
ActionScript XML Parser

Initial Tags
actionscript, xml

Initial Language
ActionScript