i'm not sure if this is a problem with the version of Flash(Flash 6) I'm using or just poor coding... but check out what the values are returning... it seems I cannot differentiate between myArray[0] and myArray[1] once [1] is assigned [0] gets all the attributes of [1]... please someone help me! here is the code:
edit: here is the xml incase it will help understand:Code://declare our xml object myXML = new XML(); //ignore any whitespace found myXML.ignoreWhite = true; var temp = new Object(); var myArray = new Array; //setup an event to track the data coming in myXML.onLoad = function(success) { //data loaded....lets begin for (var i=0; i<this.firstChild.childNodes.length; i++) { temp.Title=this.firstChild.childNodes[i].childNodes[0].childNodes[0].nodeValue; temp.Body=this.firstChild.childNodes[i].childNodes[1].childNodes[0].nodeValue; temp.Keywords=this.firstChild.childNodes[i].childNodes[2].childNodes[0].nodeValue; myArray[i]=temp; } }; myXML.load("samples.xml"); function displayMember(){ txtTitle.text=myArray[0].Title; txtBody.text=myArray[0].Body txtKeywords.text=myArray[0].Keywords; } btnNext.onPress=function(){ displayMember(); trace(myArray[0].Title + " and " + myArray[1].Title); // RETURNS:Sample Practice Two and Sample Practice Two // temp.Title="test title"; temp.Body="test body"; trace(myArray[0].Body + " and " + myArray[2].Body); //RETURNS: test body and myArray[2]=temp; //RETURNS: test body and test body trace(myArray[0].Body + " and " + myArray[2].Body); } stop();
if i'm missing any info needed to help, just let me know... Thanks in advance,Code:<samples> <sample> <title>Sample Practice One</title> <body>Fox in the whole went round and round!</body> <keywords>corporate espionage, privacy, hr</keywords> </sample> <sample> <title>Sample Practice Two</title> <body>Dog jumped over the merry fox!</body> <keywords>privacy, hr, laptops</keywords> </sample> </samples>
ChaseNYC




Reply With Quote