Link to home
Start Free TrialLog in
Avatar of joy_de_vivre
joy_de_vivreFlag for Croatia

asked on

flex - displaying time of playing videos in HH:MM:SS:FF format

Hi!
I have some application which controls a flv video. I am using DateFormatter to format play time display and it is in HH:MM:SS format.
What I would like to do is to display it with HH:MM:SS:FF format (FF = frames: from 00 to 25).

Is this possible with DateFormatter or should i "fake" it somehow?

In addition, I am attaching part of code which is relevant to my problem..

Thanks for helping!
private var start:Date;
private var timeDisplayFormatter:DateFormatter;
 
private function init():void{
	start = new Date("1/1/2000");
	timeDisplayFormatter = new DateFormatter();
	playtime.text = "00:00:00:00";
	
	loadedVideo.addEventListener(VideoEvent.READY,videoReady);
	loadedVideo.addEventListener(VideoEvent.PLAYHEAD_UPDATE,updateTimeDisplay);
	
	playButton.addEventListener(MouseEvent.CLICK, togglePlayback);
}
 
private function togglePlayback(event:MouseEvent):void{
	if (loadedVideo.playing){
		loadedVideo.pause();
	} else if (loadedVideo.source){
		loadedVideo.play();
	}
}
 
private function videoReady(event:VideoEvent):void{
	
	timeDisplayFormatter.formatString = "JJ:NN:SS";
	
	var totalTime:Date = new Date(start.getTime()+ (this.loadedVideo.totalTime*1000));
	
	videoLength = timeDisplayFormatter.format(totalTime);
	
}
 
private function updateTimeDisplay(event:VideoEvent):void{
	
	timeDisplayFormatter.formatString = "JJ:NN:SS";
	
	var currentTime:Date = new Date(start.getTime()+ (event.playheadTime * 1000) );
	
	playtime.text = timeDisplayFormatter.format(currentTime);
	
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of joy_de_vivre

ASKER

ok, you are the only one with actual thoughts about this... thanks for efforts =)