I have a site that is using xml and it is parsed like this
Code:
images_xml = new XML();
//images_xml.ignoreWhite = false;
images_xml.ignoreWhite = true;
images_xml.onLoad = function(success) {
if (!success) {
trace("Couldnt load XML file");
} else {
//parse your XML data
//trace("MY XML: " + images_xml.firstChild);
var projNode = images_xml.firstChild.childNodes;
var projTotal = projNode.length;
_root.projTotal = projNode.length;
trace("MY XML: projNode " + projNode);
trace("MY XML: projTotal " + projTotal);
for (i = 0; i < projTotal; i++) {
//create a new object for each project
trace("Object Names: " + " imageObject" + i);
imageObject = _level0["imageObject" + i] = new Object();
//add all data into an object
imageObject.id = projNode[i].attributes.id;
trace("ID: " + imageObject.id);
imageObject.date = projNode[i].childNodes[0].firstChild.nodeValue;
trace("Date: " + imageObject.date);
imageObject.name = projNode[i].childNodes[1].firstChild.nodeValue;
trace("Name: " + imageObject.name);
imageObject.introtext = projNode[i].childNodes[2].firstChild.nodeValue;
trace("introtext: " + imageObject.introtext);
imageObject.comment = projNode[i].childNodes[3].firstChild.nodeValue;
trace("Comment: " + imageObject.comment);
imageObject.start = projNode[i].childNodes[4].firstChild.nodeValue;
trace("start: " + imageObject.start);
imageObject.end = projNode[i].childNodes[5].firstChild.nodeValue;
trace("end: " + imageObject.end);
imageObject.thumb = projNode[i].childNodes[6].firstChild.nodeValue;
trace("Thumb: " + imageObject.thumb);
}
}
};
images_xml.load("project-c.xml");
Now the xml is working fine but I am trying to add a code that will search through and show the next scheduled event from inside a movieclip. I think the code should be something like this
Code:
for (i = 0; i < _root.projTotal; i++) {
tester="_root.imageObject"+i
trace(tester+" tester")
trace(tester.date+" tester.date")
trace(_root.imageObject0.date+" date")
if(_root.newday==tester.date){
trace("worked")
}
}
and that will trace
_root.imageObject0 tester
tester.date
6.18.2009 date
_root.imageObject1 tester
tester.date
6.18.2009 date
_root.imageObject2 tester
tester.date
6.18.2009 date
So as you can see the variable tester.date doesnt work but when you type out the imageObject0.date it works. Can someone please explain how I can search through the xml date info and determine if it is the same day.
Thanks I appreciate the help,
Randy