Reputation: 1076
I hope I can explain this well enough...
I've created an xml document with several different types of phases: directorsprep, checkInOut, project, pickupPhoto, syncing, and daily. Once my httpService loads the xml, the result function is as follows:
private function processPhases(e:ResultEvent):void
{
var phases:Array = new Array("directorsprep", "checkInOut", "project", "pickupPhoto", "syncing", "daily");
var xmlList:XMLList = new XMLList;
var dupString:String = "|";
var tempArray:Array = new Array;
var tempString:String = new String;
for (var i:int = 0; i < phases.length; i++)
{
xmlList = XML(e.result).phases[i];
dupString = "|";
tempArray = new Array;
for (var j:int = 0; j < xmlList.length(); j++)
{
if (phases[i] == "directorsPrep")
tempString = "|" + xmlList[j].prepDBID + "|";
else if (phases[i] == "checkInOut")
tempString = xmlList[j].checkDBID;
else if (phases[i] == "project")
tempString = xmlList[j].dbID;
else if (phases[i] == "pickupPhoto")
tempString = xmlList[j].pickupPhotoDBID;
else if (phases[i] == "syncing")
tempString = xmlList[j].syncDBID;
else if (phases[i] == "daily")
tempString = xmlList[j].dailyDBID;
if (dupString.indexOf(tempString) == -1)
{
tempArray = new Array;
if (phases[i] == "directorsPrep")
{
tempArray[0] = xmlList[j].prepDBID;
tempArray[1] = xmlList[j].projectDBID;
tempArray[2] = xmlList[j].startDate;
tempArray[3] = xmlList[j].numdays;
tempArray[4] = xmlList[j].positions;
directorsPrepAC.addItem(tempArray);
dupString += "|" + xmlList[j].prepDBID + "|";
}
else if (phases[i] == "checkInOut")
{
tempArray[0] = xmlList[j].checkDBID;
tempArray[1] = xmlList[j].projectDBID;
tempArray[2] = xmlList[j].startdate;
tempArray[3] = xmlList[j].numdays;
tempArray[4] = xmlList[j].positions;
checkInOutAC.addItem(tempArray);
dupString += "|" + xmlList[j].checkDBID + "|";
}
else if (phases[i] == "project")
{
tempArray[0] = xmlList[j].dbID;
tempArray[1] = xmlList[j].workingTitle;
tempArray[2] = xmlList[j].projName;
tempArray[3] = xmlList[j].startDate;
tempArray[4] = xmlList[j].positions;
projectsAC.addItem(tempArray);
dupString += "|" + xmlList[j].dbID + "|";
}
else if (phases[i] == "pickupPhoto")
{
tempArray[0] = xmlList[j].pickupPhotoDBID;
tempArray[1] = xmlList[j].projectDBID;
tempArray[2] = xmlList[j].startDate;
tempArray[3] = xmlList[j].numdays;
tempArray[4] = xmlList[j].positions;
pickupPhotoAC.addItem(tempArray);
dupString += "|" + xmlList[j].pickupPhotoDBID + "|";
}
else if (phases[i] == "syncing")
{
tempArray[0] = xmlList[j].syncDBID;
tempArray[1] = xmlList[j].projectDBID;
tempArray[2] = xmlList[j].startDate;
tempArray[3] = xmlList[j].numdays;
tempArray[4] = xmlList[j].positions;
syncingAC.addItem(tempArray);
dupString += "|" + xmlList[j].syncDBID + "|";
}
else if (phases[i] == "daily")
{
tempArray[0] = xmlList[j].dailyDBID;
tempArray[1] = xmlList[j].projectDBID;
tempArray[2] = xmlList[j].startDate;
tempArray[3] = xmlList[j].numdays;
tempArray[4] = xmlList[j].positions;
dailiesAC.addItem(tempArray);
dupString += "|" + xmlList[j].dailyDBID + "|";
}
}
}
}
}
The part that's giving me trouble, and the reason for this post is the line:
xmlList = XML(e.result).phases[i];
If this isn't the correct way to denote which different phase to look at, can somebody tell me what is?
Thanks for your time, Brds
Upvotes: 0
Views: 80