logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
rsuper  
#1 Posted : Monday, December 28, 2015 10:57:38 AM(UTC)
rsuper

Rank: Member

Groups: Registered
Joined: 12/24/2015(UTC)
Posts: 14
Location: Gramsbergen, Netherlands

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
I'm using the countdown timer to display a countdown to a specific date. However I would like to add the number of days remaining in the countdown.

I tried this format:

Code:
{0:30 December 2015 09:00 PM| dd:HH:mm:ss}


But the "dd" displays the day of the week (4) of the given date it counts to.
How can I add the number of days remaining, or alternatively the total number of hours instead of days? (e.g. 3 days or 72 hours)

Thanks
rsuper  
#2 Posted : Monday, December 28, 2015 11:42:32 AM(UTC)
rsuper

Rank: Member

Groups: Registered
Joined: 12/24/2015(UTC)
Posts: 14
Location: Gramsbergen, Netherlands

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
I fixed it myself by creating a Flash overlay which does what I want. I'm still interest in an answer to my question though.

For anyone who understands Actionscript 3 and Flash, this is the code (place it on the timeline):

Code:
import flash.events.Event;
import flash.text.TextField;

var endDate:Date = new Date(2015, 11, 30, 21, 0, 0, 0);
var timer:TextField;

addEventListener(Event.ENTER_FRAME, enterFrame);

function enterFrame(e:Event):void {
	var now:Date = new Date();
	var diff:Number = ( (endDate.time - now.time) / 1000);
	
	if (diff > 0) {
		var days:int = Math.floor(diff / (3600*24));
		diff %= (3600 * 24);
		
		var hours:int = Math.floor(diff / 3600);
		diff %= 3600;
		
		var minutes:int = Math.floor(diff / 60);
		diff %= 60;
		
		var seconds:int = diff;
	
		timer.text = zeroPad(days) + ":" +
                     zeroPad(hours) + ":" + 
                     zeroPad(minutes) + ":" +
                     zeroPad(seconds);
	}
	else {
		timer.text = "00:00:00:00";
	}
}

function zeroPad(num:int):String {
	return ("0" + num).substr(-2);
}


Textfield instance name is assumed to be named 'timer'.
Bardos59  
#3 Posted : Monday, December 28, 2015 9:47:44 PM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/13/2010(UTC)
Posts: 230

I tried the code, but I get an error and it does not work....was checking to see what I did wrong, but I get the error "#1065 Variable TCMText is not defined"...


Update: I downloaded a sample clock, did some modification, and got it to work...but I do not know how to upload the file....it works great, and can be modified in Flash....I am not a coder, but I followed the instructions and got it working perfect...even changed the backgrounds and colours....

This is the example and I got it to work Just scroll down to the download button, click and download, uzip, and modify....

http://dl.dropbox.com/u/...ashCountdownTimerAS3.zip

Hope this will help you.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.