STUMPED! Variable type from TXT compare problem :(
Hello Everyone :)
I'm completely STUMPED on this one, it's been driving me crackers!
This is what i'm doing :
The AS3 script sends two variables to a PHP script which in turn saves them to a TXT file, works well.
The AS3 script then reads the TXT file back and checks to see if they have been written.
The TXT file has the following lines :
var_1=Hello
&var_2=12345678
The AS3 script easily reads the varaibles back using the following lines :
var variable_name;
var variable_numb;
variable_name = loader.data.var_1;
variable_numb = loader.data.var_2;
So variable_name now holds Hello, and variable_numb holds 12345678 and i check using the following :
result.text = variable_name;
result.numb = variable_numb;
As you can see i did not need to do a toString();
The variable contents were displayed, no matter if a number OR letter.
So far so good and it works well BUT here's the problem :
Now i want to compare the returned variables to see if they are the same as i sent.
This works :
if (variable_numb == 12345678)
{
result.text = "YES, the number is 12345678";
}
But the following will NOT work :
if (variable_name == "Hello")
{
result.text = "YES, the name is Hello";
}
As a test i also tried this to see if the returned variable was a string, here's the line :
result.text = variable_name + " Mate";
What i see is this :
Hello
I should see this :
Hello Mate
I'm guessing it's a problem with the variable type returned from the txt film on var_1 & var_2.
They don't seem to be string or integer but using == to compare the variables work fine with numbers but not strings.
Can someone kindly point me in the right direction?
Thanks :)