I couldnt believe the Math.round() function in AS3 is so crippled. All it returns is the nearest integer value and ofcourse there is no way you can specify what is the precision of rounding. To make it worse it always rounds 1.5 to 1. Hmmm..
But the solution to this problem is pretty simple. For example if u want a 2 decimal place rounding all we have to do is multply with 100,then round it and then divide it by 100. Confusing..well here is the code:
public static function roundDecimal(num:Number, precision:int):Number{
var decimal:Number = Math.pow(10, precision);
return Math.round(decimal* num) / decimal;
}
Well that was pretty simple right. Now go coding..all the best.