我想将15.24514的观看次数更改为15.24
public function jackpotstring():String {
var myPattern:RegExp = /./;
var jp:Number = jackpot * denom;
jp = Math.round(jp * 100)/100;
jp = jp / 100;
var s:String = String(jp);
return s;
}
答案 0 :(得分:0)
检查:
public function roundTo(number:Number, decimals:int):Number {
var roundFactor:Number = Math.pow(10, decimals)
return Math.round(number * roundFactor) / roundFactor;
}
或者你可以使用Number方法toFixed():
var formattedNumber:String = someNumber.toFixed(2);