Hi,
I've got this bit of Action Script here which works out fine for DATES but I need to modify it for TIMES as well, such as exam date and times.
Say the Exam starts at 9.00am May 2nd 2014. Thanks
Code://This countdown will countdown to Christmas of the current year by default. You can learn how to change this at: //http://mytutorialz.wordpress.com/2011/08/27/creating-a-flash-countdown-timer/ //I would also like to ask that you keep the small credit in the footer of this countdown, it doesn't link back - so //don't worry, visitors won't leave your site for mine! Please show your support for me! :D //This line tells Flash to start the countdown on load: this.onEnterFrame = function() { //Set the variables: var today:Date = new Date(); var currentYear = today.getFullYear(); var currentTime = today.getTime(); //Now, here is where you can set the countdown date. //The format for dates in flash are: Year, Month (0-11, 0 being January), Day. //To countdown to the current year, use 'CurrentYear' or for a specific year, use '2011', '2012' etc. var targetDate:Date = new Date(currentYear, 04, 02); var targetTime = targetDate.getTime(); //Here's all the maths. Don't edit this unless you know what you're doing! var timeLeft = targetTime - currentTime; var sec = Math.floor(timeLeft/1000); var min = Math.floor(sec/60); var hrs = Math.floor(min/60); var days = Math.floor(hrs/24); sec = String(sec % 60); if (sec.length < 2) { sec = "0" + sec; } min = String(min % 60); if (min.length < 2) { min = "0" + min; } hrs = String(hrs % 24); if (hrs.length < 2) { hrs = "0" + hrs; } days = String(days); var counter:String = days + ":" + hrs + ":" + min + ":" + sec; time_txt.text = counter; } //The end!!




Bookmarks