[Flashcoders] Getting a compiler error

2008-10-30 Thread Eric E. Dolecki
if( Number(loc[0]) == NaN || Number(loc[1] == NaN )return;

Warning: 1098: Illogical comparison with NaN.  This statement always
evaluates to false.

Okay, so I have also tried

if( loc[0] == NaN || loc[1] == NaN )
return;

I get the same error. loc[0] 99.9% of the time is a string value of a number
(ie. var loc:Array = msg.split( )). Sometimes it ends up NaN, I want to
prevent NaN from going through to a later method. I would have thought I
could simply check that for NaN.

??
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Getting a compiler error

2008-10-30 Thread Ian Thomas
Try the isNaN() method:

if (isNaN(Number(loc[0])))

however, shouldn't you be using parseInt() or parseFloat() instead of
Number()? Casting a String as a Number is a risky thing to do at the
best of times!

So try:

if ((isNaN(parseInt(loc[0]))||(isNaN(parseInt(loc[1])))
  return;

HTH,
   Ian

On Thu, Oct 30, 2008 at 1:48 PM, Eric E. Dolecki [EMAIL PROTECTED] wrote:
 if( Number(loc[0]) == NaN || Number(loc[1] == NaN )return;

 Warning: 1098: Illogical comparison with NaN.  This statement always
 evaluates to false.

 Okay, so I have also tried

 if( loc[0] == NaN || loc[1] == NaN )
return;

 I get the same error. loc[0] 99.9% of the time is a string value of a number
 (ie. var loc:Array = msg.split( )). Sometimes it ends up NaN, I want to
 prevent NaN from going through to a later method. I would have thought I
 could simply check that for NaN.

 ??
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Getting a compiler error

2008-10-30 Thread Juan Pablo Califano
Use isNaN instead. For some reason I don't really get, this evaluates to
false in AS 3.0.

trace( (NaN == NaN) );

Cheers
Juan Pablo Califano

2008/10/30, Eric E. Dolecki [EMAIL PROTECTED]:

 if( Number(loc[0]) == NaN || Number(loc[1] == NaN )return;

 Warning: 1098: Illogical comparison with NaN.  This statement always
 evaluates to false.

 Okay, so I have also tried

 if( loc[0] == NaN || loc[1] == NaN )
return;

 I get the same error. loc[0] 99.9% of the time is a string value of a
 number
 (ie. var loc:Array = msg.split( )). Sometimes it ends up NaN, I want to
 prevent NaN from going through to a later method. I would have thought I
 could simply check that for NaN.

 ??
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Getting a compiler error

2008-10-30 Thread Eric E. Dolecki
Thanks Juan ;)

On Thu, Oct 30, 2008 at 10:42 AM, Juan Pablo Califano 
[EMAIL PROTECTED] wrote:

 Use isNaN instead. For some reason I don't really get, this evaluates to
 false in AS 3.0.

 trace( (NaN == NaN) );

 Cheers
 Juan Pablo Califano

 2008/10/30, Eric E. Dolecki [EMAIL PROTECTED]:
 
  if( Number(loc[0]) == NaN || Number(loc[1] == NaN )return;
 
  Warning: 1098: Illogical comparison with NaN.  This statement always
  evaluates to false.
 
  Okay, so I have also tried
 
  if( loc[0] == NaN || loc[1] == NaN )
 return;
 
  I get the same error. loc[0] 99.9% of the time is a string value of a
  number
  (ie. var loc:Array = msg.split( )). Sometimes it ends up NaN, I want to
  prevent NaN from going through to a later method. I would have thought I
  could simply check that for NaN.
 
  ??
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders