1 /** 2 * 格式化时间,格式 00:00:00 3 * @param total 总时间(毫秒) 4 */ 5 function getFormatTime(total:uint):String 6 { 7 if (total/1000 < 60 && total/1000 >0) { 8 var s0:uint = total / 1000 >> 0; 9 return s0 < 10 ? "00:0" + s0.toString() : "00:" + s0.toString(); 10 } else { 11 var h:uint = (total / 3600000) >> 0; 12 var m:uint = ((total -h*3600000)/60000)>>0; 13 var s:uint = ((total -h*3600000 - m*60000)/1000)>>0; 14 var hh:String = h < 10 ? "0" + h:h.toString(); 15 var mm:String = m < 10 ? "0" + m:m.toString(); 16 var ss:String = s < 10 ? "0" + s:s.toString(); 17 var arr:Vector.<String> = new Vector.<String>(); 18 (h > 0) ? arr.push(hh):null; 19 (h > 0|| m > 0 ) ? arr.push(mm) : null; 20 (h > 0|| m > 0 || s > 0 ) ? arr.push(ss) : null; 21 return arr.join(":"); 22 } 23 }