PDA

View Full Version : setting length on decimal numbers



johnkoroberi
July 15th, 2005, 10:11 AM
i am trying to use something like this
float_variable = parseFloat(string_var) to represent dollar amounts... is there anyway to set the length of a float variable to do this? or is there any kind of dollar datatype in AS? (im using studio mx 2004)

thanks!!

nathan99
July 15th, 2005, 10:17 AM
float_variable = Math.round(parseFloat(string_var) )

to the nearest 2?

johnkoroberi
July 15th, 2005, 10:24 AM
yes so that it just displays

x.xx

only 2 decimal places, no more or less

pom
July 15th, 2005, 11:49 AM
http://www.flashxpress.net/fxp//r_flash/f_proto/pr_number/tofixed.as