hello, im using this:
to display my flvs' duration, works a treat except it displays the time to about a million decimal places and i only want minutes and seconds, is there a way i can round this up to the nearest second?PHP Code:import fl.video.*;
flvPlayback.addEventListener(MetadataEvent.METADATA_RECEIVED, timeListener);
var durationTime:String
function timeListener(eventObject:MetadataEvent):void {
var totalSeconds = String(eventObject.info.duration);
durationTime = (totalSeconds > 3600 ? Math.floor(totalSeconds / 3600) + ":" : "") + (totalSeconds % 3600 < 600 ? "0" : "") + Math.floor(totalSeconds % 3600/60) + ":" + (totalSeconds % 60 < 10 ? "0":"") + totalSeconds % 60;
//totalTime.text = durationTime;
}
stage.addEventListener(Event.ENTER_FRAME, updateTime);
function updateTime (event:Event):void {
var elapsedSeconds = String(flvPlayback.playheadTime);
var runTime:String = (elapsedSeconds > 3600 ? Math.floor(elapsedSeconds / 36000) + ":" : "") + (elapsedSeconds % 36000 < 600 ? "0" : "") + Math.floor(elapsedSeconds % 36000/60) + ":" + (elapsedSeconds % 60 < 10 ? "0":"") + elapsedSeconds % 60 ;
elapsedTime.text = (runTime + ":" + durationTime);//<----here is where time shows
}
thanks!




Reply With Quote