HI
Putting together a very simple online form using PayPal to receive and handle payment. Which is working really well btw.
Anyway, in the simple Flash form, I have a text field that constantly updates itself using
onClipEvent (enterFrame) {}
It calculates how much the whole cost will be based upon how many items the customer wants, and their price (before shipping)
The price is $19.95
I searched the forum before and found some code that would allow me to multiply with and spit out numbers that the user can see as currency.
How ever, when you enter quantities like 2, 4 6 etc…
you get results like: 39.9, 79.8, 119.7 etc…
AS you can see, the last zero disappears, probably because the zero = nothing, so Flash doesn’t apply importance to it. Although the people I’m making the website for, don’t feel the same way.
My question, and problem is…
How do I reattach the zero?
I was thinking that you could just concatenate the zero (subtotal = price + “0”) but then you would have an extra and unwanted zero if the user wants 1, 3, 5 etc… items.
Detecting the number of total digits won’t work, unless someone knows how to detect the digits after the decimal point.
I was also thinking that possibly some kind of code like
if quantity requested is divisible by 2 then subtotal = price + “0”
else subtotal = price
would work, but I’m not entirely sure, how to write “quantity requested is divisible by 2”
Anyone have suggestions?
Here is the EXACT code I’m using on the near by movieclip
onClipEvent (enterFrame) {
//declares cost of item (there is only one)
TotalPrice = "19.95"
//takes the price and makes it usable in multiplication
PriceConvert = Number(TotalPrice);
if (_root.page.form_copies == "") {
_root.HowMany = "0"
} else {
//_root.page.form_copies is the form field the user uses to select how many copies they want
_root.HowMany = _root.page.form_copies
}
totalFigure = _root.HowMany * PriceConvert
// trace("Total Bill: " + totalFigure);
}
Thank you for your time
-Lem