Multiplying numbers with decimal points
Hi guys,
Probably a simple solution to this one, I have a function that adds the values of an array together and displays the output in a textArea(myText).
The code below works fine, but the output number is "11.5" I need this to be "11.50" and again if we set the array index [1] to "0" instead of ".50" I would need to show "11.00" instead of "11" which is what I am getting now!
var myArray:Array = new Array(1.50,.50,0,9.50);
function addValues(myArray:Array):Number{
var arraySum:Number = 0;
for (var i:uint=0; i< myArray.length; i++){
arraySum += myArray;
}
return arraySum
}
trace(addValues(myArray));
myText.text = String (addValues(myArray));
Any help would be greatly appreciated!