all groups > flash actionscript > september 2005 >
You're in the

flash actionscript

group:

== not working.. bug?


== not working.. bug? TiagoRicciardi
9/22/2005 11:42:58 PM
flash actionscript:
Hi

I'm having a little code problem..
if (success) {
var o = this.firstChild.firstChild;
while(o <> null){
menuItem = o.childNodes
area = menuItem[0].firstChild
if (area == 1) {
not_titulo = menuItem[1].firstChild
not_corpo = menuItem[2].firstChild
i++;
}
o =o.nextSibling;

everything works fine, except that the "if (area == 1) " allways return
false, and if i trace it, it shows 1 without any spaces
if i replace the == by eq it works.
I'm using flash 8 and this code used to work in mx 2004

thanks

Tiago
Re: == not working.. bug? NSurveyor
9/22/2005 11:50:50 PM
Try:

Number(area) == 1

Re: == not working.. bug? TiagoRicciardi
9/22/2005 11:57:41 PM
Hmm i've tried.. it doesn't work either..
still get's mt a false result.
The != instead of <> i knew.. but it's an habit from other programing languages..

Thanks
Tiago

Re: == not working.. bug? Ganesh GV
9/23/2005 7:30:19 AM
Try

area = menuItem[0].firstChild.nodeValue.



Re: == not working.. bug? TiagoRicciardi
9/23/2005 10:34:59 AM
Ganesh GV
thanks it works..
Still it's strange why it didn't work before, as area value was correct.

Re: == not working.. bug? Ganesh GV
9/23/2005 10:38:53 AM
Hi

in this case the value gets assigned is String type.
area = menuItem[0].firstChild.nodeValue.


but in this case the value gets assigned is XMLNode type object.
area = menuItem[0].firstChild

that might be the reason.


Re: == not working.. bug? Nephthys101
9/23/2005 11:16:59 AM
Surely that then make the distinction between equality (==) and strict data type equality (===) a little redundant?
Or is that done away with in Flash8?

Re: == not working.. bug? TiagoRicciardi
9/23/2005 8:07:03 PM
It seems.. but in flash help it says == should compare diferent data types..
and the eq operator, though it's deprecated in favor of ==, should be the
same..
probably a bug of some kind..

Ricciardi
AddThis Social Bookmark Button