Miriam
Miriam

Reputation: 1

How can I remove the decimals without rounding the number in AS3?

Usually, I would use toFixed to get less decimals, but this time I need the number to not be rounded. Example: 3.99 -> 3 How can I do this?

Upvotes: 0

Views: 886

Answers (1)

akmozo
akmozo

Reputation: 9839

You can use int :

trace(int(3.99))           // gives : 3

Or Math.floor :

trace(Math.floor(3.99))    // gives : 3

Upvotes: 3

Related Questions