ActiveDen

Timecode to Seconds / Seconds to Timecode AS2/AS3

This is a simple class I created for AS2 and AS3 . It is very handy for video or audio players. For example, say you have a video player and getting the playhead time is easy, right? Right! vidPlayer.playheadTime will give you the amount of seconds. Now you want to display this as a time code instead. You simply do the following:

tc.secondsToTimecode(vidPlayer.playheadTime);

and that will output a string formatted timecode as “01:23:48”

or whatever the seconds happen to be.

This class also supports the opposite. It allows you to convert a string into seconds. This can be handy if maybe you have cue points and you want to insert them via XML with timecodes rather than seconds because timecodes are easier to read. You would simply do:

tc.timecodeToSeconds(“01:23:48” )

and it will return a number in seconds.

Play around with the preview to get a better understanding. My help file explains how to include these in your files.

by
by
by
by
by