I would suggest sending the value as a string instead of a long, and do a type conversion from the string to long afterwards and just place logic to check if the string is NaN before you convert it taking the appropriate actions.
--- In flexcoders@yahoogroups.com, Jeff Krueger <[EMAIL PROTECTED]> wrote: > > Anyone else have this problem or am I just doing something wrong. > > Thanks > > Jeff > > > Jeff Krueger <[EMAIL PROTECTED]> wrote: > I have considered coming up with a number like -999999 and then assume that to be null and initialize all my Number variables to it and then translate that in java to null. But that is a hack at best. > > Anyone else?? > > Jeff > > > Douglas McCarroll <[EMAIL PROTECTED]> wrote: > Okay. So this is normal FDS behavior, as explained in the docs. The > question becomes "How can we deal with this limitation of FDS?" > > I don't know an answer but perhaps others on the list do. > > Has anyone else wished that they could pass NaN or null into Java? How > did you deal with this FDS limitation? > > And perhaps Adobe could comment on whether there's any chance that this > behavior will change in the future. > > Douglas > > Jeff Krueger wrote: > > This is correct. My Number in my as class isn't really null it is > > NaN. But I believe that to be the actionscript equivalent to null for > > a number. And yes when I pass that to java function that function > > recieves the class with a 0 for the Long instead of null. > > > > Here is the output from the console of the app server. Notice the > > variable XPos, YPos and deployed. See how what I send in is NaN (or > > null) and it is converted to a 0. > > > > [Flex] Deserializing AMF/HTTP request > > Version: 3 > > (Message #0 targetURI=null, responseURI=/2) > > (Array #0) > > [0] = (Typed Object #0 'flex.messaging.messages.RemotingMessage') > > operation = "findStoryByExample" > > source = null > > body = (Array #1) > > [0] = "2" > > [1] = (Typed Object #2 'com.routeto1.flex.media.vo.StoryVO') > > headline = "c" > > XPos = NaN > > validToDate = null > > pageDef = null > > deployedPath = "" > > validFromDate = null > > subHeadline = "" > > storyGraphic = null > > YPos = NaN > > keywords = "" > > body = "" > > source = "" > > bylineOccupation = "" > > publishedDate = null > > otherReferences = "" > > referenceId = "" > > deployed = NaN > > byline = "" > > pk = "" > > updatedByUser = null > > selected = false > > dateUpdated = null > > copyForSearch = false > > createdByUser = null > > createdByUserName = "" > > dateCreated = null > > clientId = null > > timeToLive = 0 > > messageId = "A5C134A1-DC44-4514-6B85-43FE21B96CB1" > > headers = (Object #3) > > DSEndpoint = "my-amf" > > destination = "mediaDelegate" > > timestamp = 0 > > [Flex] Adapter 'java-object' called > > 'com.routeto1.flex.media.MediaDelegate.findS > > toryByExample(java.util.Arrays$ArrayList (Collection size:2) > > [0] = 2 > > [1] = com.routeto1.flex.media.vo.StoryVO > > YPos = 0 > > dateUpdated = null > > XPos = 0 > > byline = > > publishedDate = null > > dateCreated = null > > pageDef = null > > copyForSearch = true > > validFromDate = null > > validToDate = null > > deployedPath = > > createdByUser = null > > bylineOccupation = > > body = > > headline = c > > keywords = > > subHeadline = > > deployed = 0 > > referenceId = > > pk = > > updatedByUser = null > > otherReferences = > > storyGraphic = null > > createdByUserName = > > source = > > )' > > > > Thanks > > > > Jeff > > > > > > */Douglas McCarroll <[EMAIL PROTECTED]>/* wrote: > > > > Jeff, > > > > Let me get this clear. If I understand correctly you're passing an AS > > number hoping that it will convert to a Java Long. But your number is > > set to null, and you'd like it to convert to null on the Java type. > > > > Is this correct? > > > > Douglas > > > > Jeff Krueger wrote: > > > Thanks. I am not using a primitive, I am using Long. I wonder what > > > it does for those. > > > > > > Jeff > > > > > > > > > */Douglas McCarroll <[EMAIL PROTECTED] > > <mailto:org.yahoo_primary.001%40douglasmccarroll.com>>/* wrote: > > > > > > Jeff, > > > > > > I'm not sure that this will help you find a solution, but it > > confirms > > > that this is a known issue: > > > > > > > > http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part1_GetStarted.html > > <http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part1_GetStarted.html> > > > > > <http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part1_GetStarted.html > > <http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part1_GetStarted.html>> > > > > > > "Primitive values cannot be set to null in Java. When passing > > Boolean > > > and Number values from the client to a Java object, Flex > > > interprets null > > > values as the default for primitive types; for example, 0 for > > double, > > > float, long, int, short, byte, \u0000 for char, and false for > > > Boolean. > > > Only primitive Java types get default values." > > > > > > Douglas > > > > > > ------------------------------------------------- > > > > > > Douglas McCarroll > > > > > > CairngormDocs.org Webmaster > > > http://www.CairngormDocs.org <http://www.cairngormdocs.org/> > > <http://www.cairngormdocs.org/ <http://www.cairngormdocs.org/>> > > > > > > Flex Developer > > > http://www.brightworks.com <http://www.brightworks.com/> > > <http://www.brightworks.com/ <http://www.brightworks.com/>> > > > 617.459.3840 > > > > > > ------------------------------------------------- > > > > > > 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 > > > > > > > > > > > > ---------------------------------------------------------- > > > > Access over 1 million songs - Yahoo! Music Unlimited. > > > > > > > > > <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=36035/*http://music.yahoo.com/unlimited/ > > <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=36035/*http://music.yahoo.com/unlimited/> > > > > > <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=36035/*http://music.yahoo.com/unlimited/ > > <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=36035/*http://music.yahoo.com/unlimited/>>> > > > > > > > > > > > > > > > > > > > > ---------------------------------------------------------- > > > Want to start your own business? Learn how on Yahoo! Small > > Business. > > > > > <http://us.rd.yahoo.com/evt=41244/*http://smallbusiness.yahoo.com/r-index > > <http://us.rd.yahoo.com/evt=41244/*http://smallbusiness.yahoo.com/r-index>> > > > > > > > > > > > > > > ---------------------------------------------------------- > > Everyone is raving about the all-new Yahoo! Mail beta. > > <http://us.rd.yahoo.com/evt=45083/*http://advision.webevents.yahoo.com/mailbeta> > > > > > > > > > > --------------------------------- > Access over 1 million songs - Yahoo! Music Unlimited. > > > > > --------------------------------- > Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. >