I have a basic calculation, but I can't figure out how to make the total tower with two decimal places

Here is the code I use. I looked everywhere, but I couldn't find answers on how to round specific numbers, not total String.

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

gccalculate.addEventListener (TouchEvent.TOUCH_TAP, fl_TapHandler_21);

function fl_TapHandler_21(event:TouchEvent):void

{

var a: number = Number (input1.text) * Number (input2.text) *.01 * Number (input3.text).

total.set_Text = String (a);

}

use toFixed():

Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;

gccalculate.addEventListener (TouchEvent.TOUCH_TAP, fl_TapHandler_21);

function fl_TapHandler_21(event:TouchEvent):void

{

var a: number = Number (input1.text) * Number (input2.text) *.01 * Number (input3.text).

total.set_Text = a.toFixed (2);

}

Tags: Adobe Animate

Similar Questions

Maybe you are looking for