Hi
I have tried and tried but i cannot get a number to force show 2 decimal places.
I have lots of different buttons and selection boxes that output a different value for ‘sizePrice’ and ‘effectPrize’. An example can be seen below:
if (sizeSelectionBox.value=="size1") {
sizePrice=67.20;
calcTotalPrice();
}
if (sizeSelectionBox.value=="size2") {
sizePrice=49.99;
calcTotalPrice();
}
if (effectSelectionBox.value=="effect1") {
effectPrice=12.00;
calcTotalPrice();
}
Each time the selection is pressed it defines the amount for either effect and size and calls the ‘calcTotalFunc’ fucntion which is shown below:
function calcTotalPrice() {
var totalPrice = (sizePrice + effectPrice);
var Cost:Number = Number(totalPrice);
var totalCost = int((Cost)*100)/100;
totalPrice_txt.text=totalCost;
}
I need totalCost to always show 2 decimal places so if it is 60 it needs to say 60.00, if it is 67.2 it needs to say 67.20
I thought the *100/100 should do it but its not - can anyone help?
Many thanks