-
Displaying decimal numbers? (HELP!)
I'd be surprised if there wasn't a way to do this, but I haven't been able to figure it out yet:
I need to be able to diplay the price of something in a dynamic textbox, which should include both dollars and cents. Depending on what you select for "quantity" the price changes dynamically.
The problem is, if the value of the "price" variable is a number and not a string and there are zeros to the right of the decimal, they are simply and understandably dropped (example: 8.50 is displayed as 8.5). Because the value of price is always the product of the BasePrice times the Quantity, it is a number by default, not a string.
Is there an actionscript method that allows you to define the number of places to the right of the decimal there should be for a given variable?
Any suggestions would be appreciate!
Thanks,
Shane:confused:
-
Just write a function that evaluates the number of decimal places after the decimal point, and add a zero, or round as necessary.
--Andrew
---Trmbne2000@hotmail.com
<---Trmbne2000@hotmail.com--->
-
search is busy at this time, so i'll let you do it.
There is a post by 'robertpenner' which covers that subject in this forum.
Lots of very useful functions by Mr Penner
gparis
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|