So I always get questions about streaming FLV players. For special effects like the fire on Acidbetty.com or intro movies and simple embedded flv video players. So one issue I came up with was displaying the length of the video and also the current frame of the video in regard to minutes and seconds.
So the actionscript code below is the code I used to display current time playing and the total time of video. ie: 1:32 / 2:45.
// Progress Bar Function and Counter Functions
progressBar.onEnterFrame = function() {
this._width = bw*ns.time/ns.totalTime;
//TOTAL TIME
myTime = (ns.totalTime);
myTime = String(myTime);
var Ttime:Number = Math.floor(Number(ns.totalTime));
var minutes:Number = Math.floor(Ttime/60);
var seconds = Math.floor(Ttime%60);
var frames = Math.floor(Ttime%24);
if (seconds<10) {
seconds = (“0″+seconds);
}
//CURRENT PLAYING TIME
myTime2 = (ns.time);
myTime2 = String(myTime2);
var Ttime2:Number = Math.floor(Number(ns.time));
var minutes2:Number = Math.floor(Ttime2/60);
var seconds2 = Math.floor(Ttime2%60);
var frames2 = Math.floor(Ttime2%24);
if (seconds2<10) {
seconds2 = (“0″+seconds2);
}
//Now a Dynamic Text Box with Var: counter will display right
counter = minutes2+”:”+seconds2+” / “+minutes+”:”+seconds
};