Skip to main content
malloryw21931978
Participant
March 15, 2016
Question

How do I make a countdown to a specific date using Animate CC 2015.1 Release?

  • March 15, 2016
  • 1 reply
  • 1464 views

I need this for a comic convention and we are trying to count down to June 17th, 2016. I tried the other forum resources and it gives me an error that the syntax isn't working with the new Animate CC.

I want it to be in terms of how many months, days, hours, minutes, and seconds it is.

Thanks!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
March 15, 2016

var countdown_time:Date=new Date(2016,5,17).time;

var t:Timer=new Timer(1000,0);

t.addEventListenter(TimerEvent.TIMER,timerF);

t.start();

function timerF(e:TimerEvent):void{

trace(formatF((countdown_time-new Date().time)/1000);

}

function formatF(sec:Number):String{

var mo:int=Math.floor(sec/(60*60*24*30));

var rem_sec:Number = sec-mo*60*60*24*30;

var day:int = Math.floor(rem_sec/(60*60*24));

rem_sec -= day*60*60*24;

var hr:int = Math.floor(rem_sec/(60*60));

rem_sec -= hr*60*60;

var min:int = Math.floor(rem_sec/(60));

rem_sec -= min*60;

return mo+':Months, '+day+':Days, '+hr+':Hours, '+min+':Minutes, '+sec+':Seconds';

}