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
|
|
|
|
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'.
|
|
|
|
Rank: Guest
Groups: Guests
Joined: 1/13/2010(UTC) Posts: 230
Was thanked: 3 time(s) in 3 post(s)
|
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.zipHope this will help you.
|
|
|
|
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.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close