URLLoader data not being recognized by conditional statement - AS3


I am loading data from php using the echo method into flash via the URL loader:URLLoader method. The data then gets assigned to an object.

My problem is that the loaded data is being imported in fine and I can trace it and even display it in a text box, but if I try and use this data in a conditional statement - the statement just won’t recognize its value?

Below is a sample of my code…
I’m pulling my hair out atm…

My PHP—v
$row = mysql_fetch_array($query);
echo “result=success”;
echo “&unit=$row[unit]”;

My AS3—v
var loader:URLLoader = URLLoader(e.target);
var result = loader.data.result;

if (result == "success")
	var n = loader.data;
	[COLOR="Lime"]if (n.unit == "inchs") {
            else {


My problem is in green above. The variable/data being imported in is indicating which measuring unit the user preferred - “inchs” for inch’s or “cms” for centimeter’s.

The statement never seems to recognize this data and always proves false and ‘else’ is executed.

However if I instruct the data to be displayed in a text box eg.
“display.text = n.unit;” The text box displays the correct result as if the data has came across fine?

Any help would be greatly appreciated. Cheers