How do I format numbers?

[font=verdana, arial, helvetica][size=2]Can someone tell me how I can format numbers in Flash so that it will show two decimal places regardless of the number itself?

Thanks.

OM[/size][/font]

do a forum search for format numbers and you’ll find what you need.

hi there… i’ve tried something really simple… but came across of a bug (??). Does anybody know why this happens?


y = 145.24;
decimals = Math.floor((y-Math.floor(y))*100);
trace (y-Math.floor(y));// this traces 0.240000000000009
trace (Math.floor(y)+","+decimals);//this works... sometimes :)

Anybody?
I know the code is not really working as OM2 wanted, but I am very curious about this thing with the Math.floor stuff.

see:
http://www.macromedia.com/support/flash/ts/documents/roundoff_error.htm

10x a lot senocular.
As they say "This is a fact of life " - I too should probably live with it :slight_smile: