Hello,
I am building a flv player with time display.
Here is the code I am using:
Code:
// event listener for changing the time display
function updateNP(event:Event):void {
// time code code...
var totalSeconds:Number = theplaya.playheadTime;
var totalSeconds2:Number = theplaya.totalTime;
var minutes:Number = Math.floor(totalSeconds /60);
var minutes2:Number = Math.floor(totalSeconds2 /60);
var seconds = Math.floor (totalSeconds) % 60;
var seconds2 = Math.floor (totalSeconds2) % 60;
if (seconds < 10){
seconds = "0" + seconds;
}
if (seconds2 < 10){
seconds2 = "0" + seconds2;
}
timeBox.text = minutes + ":" + seconds + " / " + minutes2 + ":" + seconds2;
}
this.addEventListener (Event.ENTER_FRAME, updateNP);
When the player first loads the video the total time is displayed as "NaN" before it gets the length information. How can I set the initial value to "0:00" instead of having "NaN" displayed?
I tried setting the value at the top of my actionscript (before the previously listed event handler) to:
Code:
timeBox.text = "0:00 / 0:00";
But it still listed the totaltime as NaN before it displays the actual length.
Thanks,
mperla