Simple Scoreboard (score + clock)


I am new to flash and AS3. I need to make a simple template for football with score and timer.
I tried to make a template all by myself but without success.
So I download the templates of the "World Cup 2010", the only problem is that i do not know how to use this template in CasparCG. What should we pass into arguments?
I read the AS code but I do not understand everything.

Would you have an example of a template that could serve me? Or links to a solution to my problem?

I know that several posts already deal with the subject but they are old enough and the links are not always up to date.

thank you very much

Re: Simple Scoreboard (score + clock)

I think, scoring is not the main issue - its the timer.... right ?

There are two ways:

1.) Use a simple tetxfield in your template and send a update erery second from your client Software (in my case a custom VB-Software). This is the way I did it already. But there is a very small delay. For soccer, it may be no problem, because no match ends exactly after 90 minutes. The displayed time is not official....

2.) You can send a starting time and calculate the the current time inside templates action script. The time is more exact. Sorry, for this I'm not the right advisor....

Re: Simple Scoreboard (score + clock)

thos_berlin, yes the main issue is the timer. I thought of sending the data from my client but I was afraid to overload CasparCg with the commands every second.
Your second point is interesting but my current skills do not allow me to develop the timer in this way :)

I just make some tests :

Code: Select all

package  {
	import flash.display.MovieClip;
	import flash.utils.Timer;
	public class premiere_clock extends MovieClip {
		public var clock:Timer = new Timer(1000,60);
		public var sec:int = 0;
		public var min:int = 0;
		public function premiere_clock() {
			// constructor code
			clock.addEventListener(TimerEvent.TIMER, secondes);
			clock.addEventListener(TimerEvent.TIMER_COMPLETE, minutes);
		private function secondes(e:TimerEvent):void {
			//trace('tick: '+clock.currentCount);
			if(clock.currentCount <= 9) {
				trace("secondes: 0"+clock.currentCount);
				T_secondes.text = "0"+clock.currentCount.toString();
			}else {
				trace("secondes: "+clock.currentCount);
				T_secondes.text = clock.currentCount.toString();
		private function minutes(e:TimerEvent):void {
			T_secondes.text = "00";
			if(min <= 9) {
				T_minutes.text = "0"+min.toString();
			}else {
				T_minutes.text = min.toString();

At first glance, my code works (it may not be optimal) but by letting it run 3 times over 45 minutes, I get the impression that sometimes a gap is created...

Didi, I will analyze the code of your template and see if I can adapt it to my needs.
The goal is not to use this timer only on football, I would like to adapt it to sports like basketball. For football, the delay does not bother me. For basketball, it's a little more boring: /

In any case, thank you for devoting me a little of your time.
I come back to you once I have understood the template of Didi.

Sry for my bad english and Thank you !

Re: Simple Scoreboard (score + clock)

The problem with this approach, by just having a timer every second and counting up a variable, is, that based on the current system performance load, it can happen, that the timer fires a bit later. After a few minutes you start to notice this, by seeing a difference between the stadium clock and your timer. At least if you do not have a super hyper power computer :) My approach to sports clocks is, that I store the start time (and date) on the click of the start button. Then the time is calculated as the difference between the start time and the current time. Result: It does not matter how much the timer lags, you will always be accurate in regard to the stadium clock. I normally also do it the way thosberlin mentioned, by doing all the calculation inside my client software and only update the template once a second. But I only do it lke that, because I have the running clock also visible in my GUI and so it does not make sense to do the calculation again inside the template.

By the way, there is a tread where different Caspar clients are presented. As I mentioned there, I am programming SCOREPLUS for Streamstar. And just rescently we published a basketball client that can also get its data from the in-stadium scoreboard. In basketball that is baddly needed, as you have a clock and a shoot-clock and they start and stop randomly. So to operate this by hand is a horible stress and you will always be too late...
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland
Problems? Guide to posting Bug reports & Feature requests

Re: Simple Scoreboard (score + clock)

Oh, I have a Streamstar for diffusions when I have to move (nice machine but software that contains a lot of bugs since version 4 ...).

I'll use what you've just told me, use the departure date / time and then make a difference. The template you posted this morning works on this principle? I did not have time to look at the code yet.

Thank you!

Re: Simple Scoreboard (score + clock)

boomker wrote:
19 Oct 2017, 15:18
The template you posted this morning works on this principle?
No, it is more of a real time clock. But it demonstrates a lot of stuff for date/time handling. The rest is easy made "with a little help from my friend" (Google).
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland
Problems? Guide to posting Bug reports & Feature requests