Be a Supporter!

Edits to post #25290498 by Aprime

Back to Xml , Loops And Objects

Edited at 2014-11-10 05:25:04

Funny thing also is that when I trace

trace(temp[ni]);

I get the 4th item on the pipe for the header.
Why 4th?
Also when I do temp[ni+1]. Of course I get the 5th. Meaning if I want the 1st I'd have to do ni-3.

Hmm I guess I could try

targetObjArray = temp.split("|");
for (var i= 0; i < objArray.length; i += 2){
	obj[objArray[i]] =objArray[i + 1];
}

This doesnt work. I'd get an error

targetObjArray = temp[ni].split("|");
for (var i= 0; i < objArray.length; i += 2){
	obj[objArray[i]] =objArray[i + 1];
}

Even though it starts on 4, there are no errors

My if no longer works though

if (targetObj["age"] == '254'){
	trace("working");
}

Funny thing also is that when I trace

trace(temp[ni]);

I get the 4th item on the pipe for the header.
Why 4th?
Also when I do temp[ni+1]. Of course I get the 5th. Meaning if I want the 1st I'd have to do ni-3.

Hmm I guess I could try

targetObjArray = temp.split("|");
for (var i= 0; i < objArray.length; i += 2){
	obj[objArray[i]] =objArray[i + 1];
}

This doesnt work. I'd get an error

targetObjArray = temp[ni].split("|");
for (var i= 0; i < objArray.length; i += 2){
	obj[objArray[i]] =objArray[i + 1];
}

Even though it starts on 4, there are no errors

My if no longer works though

if (obj["age"] == '254'){
	trace("working");
}