How can I create a count up calendar from designate period with actionscript 3.0???
e.g 5/7/2010 to 14/3/2016
e.g 5/7/2010 to 14/3/2016
Sorry for insufficient information
actually, i just wanna make a video and the count up period is part of the video.
just wanna show the date going from past to now (e.g 5/7/2010 to 14/3/2016), counting up the date let said 10 days/one second and finally it take around 1-2 mins to finish the count action.
I'm using adobe flash CC 2014, and the final product run in android.
so i assume you're not using an old version of flash and you're not using actionscript 2.
use:
var count:int = 0;
var current_date:Date=new Date();
var past_date:Date=new Date(2010,6,5);
var daysBetweenDates:Number=(date1.time-date2.time)/(1000*60*60*24);
var t:Timer=new Timer(100,0);
t.addEventListener(TimerEvent.TIMER,countdownF);
t.start(); // execute this line when you want to start the countdown display
function countdownF(e:TimerEvent):void{
tf.text = 'Days since '+formatF(current_date)+' : '+count;
count++;
if(count>daysBetweenDates){
t.stop();
}
}
function formatF(d:Date):String{
var mo:String = (d.month+1).toString();
while(mo.length<2){
mo='0'+mo;
}
var dateS:String = d.date.toString();
while(dateS.length<2){
dateS='0'+dateS;
}
return dateS+'/'+mo+'/'+d.fullYear;
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.