I ha开发者_如何学运维ve generated actionscript (AS3) beans from the Serverside(java).
Now some of the classes had (Long,long,double) which I had to convert into Number on the Actionscript side (as we dont have long ,double etc ) on AS3 side.
Now I have to validate Number on AS3 side to match type on Serverside .
Let take example I have a field
private long number ;
in java which is converted as
private number:Number ; on AS side
this will accept number as (Double Long etc) but we know that we cannot fit Double into long on java
so I am wondering is there anyway we can validate AS3 Number to be valid "Long" on Acrionscript side ?
Thanks
I would hard code the ceiling for a 'long' and then compare against that when sending a value to the server. Like so:
var floatCeiling:Number = Math.pow(2, 63) - 1;
var testValue:Number = 1000000000000000000000000;
if(testValue >= floatCeiling) {
//tell the server to cast this value to 'double' when it gets it
} else {
//tell the server to cast this value to 'long' when it gets it
}
That might be a little hacky for some, but, hope it helps :)
精彩评论