jeudi 26 janvier 2017

Multiplying decimals in Actionscript 3

I'm making a tax calculator for my class and I can't figure out how to multiply a whole number with a decimal. I have to multiply the whole by 0.13. Here's my code

var amount:Number;
var hst:int;

amount_txt.restrict = "0-9";



calculate_btn.addEventListener(MouseEvent.CLICK, calculate);

function calculate(event:MouseEvent):void
{
  amount = Number(amount_txt.text);

total_txt.text = "You have spent a total of " + String(Math.round((amount * hst)) + "$") 
}

I would appreciate help quick, as it is due tomorrow. I apologize if the formatting on here is incorrect, but I assure you on the actual program it is correct. Thanks

Aucun commentaire:

Enregistrer un commentaire