Hi,
I have a relatively small actionscript that colors the states on a map based on xml data. It worked fine for a long time, but I just added a lot of data. With the new data, the xml file is a lot bigger; and the states stop getting colored around Utah. It seems to be processing the map before it has finished processing the xml file. To check, I removed all of the Texas data and Utah then displayed correctly.
Thanks for any help,
Debbie
AS2 is pretty forgiving language and xml is not native to it so it does like what browsers do and loads as best as can be interpreted. My guess is that your xml is malformed. Try opening your xml in an editor or even IE to make sure it is structured correctly. This will show you if there is an issue.
if ((substring(response, 1, 3) == "Yes" && qid == "b")) {
myColor = new Color(state);
myColor.setRGB(0xA2B5CD);
} else if ((substring(response, 1, 3) != "Yes" && qid == "b")) {
myColor = new Color(state);
myColor.setRGB(0xcccccc);
}
}
function parseFile(xmlDoc_xml) {
temp = new Array();
for (var a = 0; a<xmlDoc_xml.firstChild.childNodes.length; a++) {
for (var b = 0; b<xmlDoc_xml.firstChild.firstChild.childNodes.length; b++) {
temp[b] = xmlDoc_xml.firstChild.childNodes[a].childNodes[b].firstChild.nodeValue;
}
n = new Map(temp[0], temp[1], temp[2], temp[3], temp[4]);
dp.push(n);
}
}
function showArray() {
for (var z = 0; z<dp.length; z++) {
trace(dp[z].state);
trace(dp[z].category);
trace(dp[z].question);
trace(dp[z].response);
trace(dp[z].qid);
}
}