as3将目标数字转换为时间格式方法
比如 120秒 转换成 00:02:00格式
code:
1 private function formToTimeString(__time:Number, __insertHout:String = ":",__insertMinute:String = ":"):String {
2 var __hour:uint = __time / 60 / 60 >> 0;
3 var __minute:uint = (__time / 60) % 60;
4 var __second:uint = __time % 60;
5
6 var __timeTxt:String = "";
7
8 __timeTxt += ((__hour > 100) ? __hour.toString() : (100 + __hour).toString().substr(1))+__insertHout;
9 __timeTxt += ((__minute < 10)?("0" + __minute.toString()):__minute.toString()) + __insertMinute;
10 __timeTxt += (__second < 10)?("0" + __second.toString()):__second.toString();
11
12 return __timeTxt;
13 }
2 var __hour:uint = __time / 60 / 60 >> 0;
3 var __minute:uint = (__time / 60) % 60;
4 var __second:uint = __time % 60;
5
6 var __timeTxt:String = "";
7
8 __timeTxt += ((__hour > 100) ? __hour.toString() : (100 + __hour).toString().substr(1))+__insertHout;
9 __timeTxt += ((__minute < 10)?("0" + __minute.toString()):__minute.toString()) + __insertMinute;
10 __timeTxt += (__second < 10)?("0" + __second.toString()):__second.toString();
11
12 return __timeTxt;
13 }