Forum ActionScript 3.0 Get Float

Problems and discussions relating to ActionScript 3.0 here.

Get Float

Postby mfranzs » March 1st, 2011, 11:10 pm

Hello.

If I wish to send a float from serverside to my client, how can I?

The only methods are:

getBoolean (index:int):Boolean

getByteArray (index:int):flash.utils:ByteArray

getInt (index:int):int

getNumber (index:int):Number

getString (index:int):String

getUInt (index:int):uint


How can I send a decimal number? (Meaning my float) Do I have to convert it somehow?

Thanks!
mfranzs
 
Posts: 98
Joined: August 29th, 2010, 3:27 am

Re: Get Float

Postby HAnz » March 1st, 2011, 11:59 pm

I've never tried to send a float from the server but when I send a double from the server I use "getNumber (index:int):Number" in flash to recieve it. Maybe that will also work for floats.
I make games and stuff.
User avatar
HAnz
 
Posts: 46
Joined: August 7th, 2010, 2:59 pm

Re: Get Float

Postby Billy » March 9th, 2011, 3:56 am

That would make sense. Just to elaborate, Actionscript doesn't HAVE a float type! The Number type is a 64-bit double precision type, and it encompasses floats as well (that is, what in other languages like C would be differentiated as a 'float', distinct from a 'double')

The Number data type uses the 64-bit double-precision format as specified by the IEEE Standard for Binary Floating-Point Arithmetic (IEEE-754)


You can read more about the data types in AS3 here: http://www.adobe.com/livedocs/flash/9.0 ... 000047.htm
Billy
 
Posts: 4
Joined: June 23rd, 2010, 4:31 pm

Re: Get Float

Postby mfranzs » March 9th, 2011, 3:58 am

Wow... I was pretty stupid.... there isn't a float duh :| >.<

I just decided to change it to a double like Hanz said and my problems went away.

Thanks guys!
:D
mfranzs
 
Posts: 98
Joined: August 29th, 2010, 3:27 am


Return to ActionScript 3.0