You could also just do this:
ActionScript Code:
num = Number(num.toFixed(2)); // trims number to 2 decimal places
If you want to actually round to 2 decimal places you can try:
ActionScript Code:
function roundNumToLength(number:Number, decimalPlaces:Number):Number {
var decimal:Number = Math.pow(10, decimalPlaces);
return Math.round(number * decimal) / decimal;
}
// example:
roundNumToLength(0.941) // returns 0.94
roundNumToLength(0.949) // returns 0.95