Revision: 54251
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 17, 2011 00:46 by vamapaull
Initial Code
package com.vamapaull.utils
{
public class TimeUtil
{
public static function getTimecode(value:Number):String
{
var t:Number = Math.round(value),
min:Number = Math.floor(t/60),
sec:Number = t%60,
tc:String = "";
if(min < 10)
tc += "0";
if(min >= 1)
{
if (isNaN(min) == true) tc += "0";
else tc += min.toString();
}
else
tc += "0";
tc += ":";
if(sec < 10)
{
tc += "0";
if (isNaN(sec) == true) tc += "0";
else tc += sec.toString();
}
else
{
if (isNaN(sec) == true) tc += "0";
else tc += sec.toString();
}
return tc;
}
}
}
Initial URL
http://blog.vamapaull.com/timecode-utility/
Initial Description
It's very useful if you build a FLV player for example, and want to convert the time into minutes:seconds (example: 6:13) //apply it to your project like this (and don't forget to import the class): time.text = TimeUtil.getTimecode(timeValue);
Initial Title
Timecode Utility
Initial Tags
actionscript, convert, 3
Initial Language
ActionScript 3