First, the behavior of ActionScript 3 Number, int and uint is based on
the ECMA Script 4 specification (well, at least what this specification
stipulated at the time of release). Given that AS3 has been released
Flex is dependent on the way it is today.
 
Second, Java primitives can't be null (they default to 0 if one tries to
provide null to them on reflection). So, if you wanted to preserve a
null value then your Java propeties would have to use the Object form of
the Java numeric types.
 
Third, for ActionScript integer types (i.e. int and uint), and Java
integer types (long, int, short, and byte) can not accept NaN. If you
try to get the long value from Double.NaN (or Float.NaN) you'll get 0.

Fourth, ActionScript Number goes over the wire in AMF3 using the double
type and is deserialized as a Java Double. On instantiating your remote
Java object or passing a parameter to a method to be invoked this Double
is translated to the required type using reflection and translation.

So, an ActionScript Number.NaN -> Java Double.NaN -> Java Long 0 and
thus your limitation is that AS numeric types can't be null in general
and Java integers can't be NaN.

So you need to either use Object in ActionScript to hold null or use
Double (or Float) in Java to hold NaN.

Pete

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jeff Krueger
Sent: Tuesday, December 05, 2006 10:38 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] FDS number NaN



Anyone else have this problem or am I just doing something wrong.
 
Thanks
 
Jeff

                > >
                > > Jeff Krueger wrote:
                > > > All,
                > > >
                > > > I am finding that when I pass a actionscript class
to a remote
                > > > java object and a number variable type in the
actionscript
                > class is
                > > > set to NaN (Null), that the java class gets set to
a 0, instead
                > > of a
                > > > null. Is there something I am missing or something
I need to set
                > > the
                > > > number to so it will be null in my java class?
                > > >
                > > > Thanks
                > > >
                > > > Jeff

Reply via email to