Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Create your Date() object
- var annee:Number = 2015;
- var mois:Number = 0;
- var jour:Number = 0;
- var heure:Number = 0;
- var minute:Number = 60;
- var seconde:Number = 10;
- // mois -1 (don't ask) probably a flash bug beginning months at month 0
- var endDate:Date = new Date(annee,mois-1,jour,heure,minute,seconde);
- //Create your Timer object
- //The time being set with milliseconds(1000 milliseconds = 1 second)
- var countdownTimer:Timer = new Timer(1000);
- //Adding an event listener to the timer object
- countdownTimer.addEventListener(TimerEvent.TIMER, updateTime);
- //Initializing timer object
- countdownTimer.start();
- //Calculate the time remaining as it is being updated
- function updateTime(e:TimerEvent):void
- {
- //Current time
- var now:Date = new Date();
- var timeLeft:Number = endDate.getTime() - now.getTime();
- //Converting the remaining time into seconds, minutes, hours, and days
- var seconds:Number = Math.floor(timeLeft / 1000);
- var minutes:Number = Math.floor(seconds / 60);
- var hours:Number = Math.floor(minutes / 60);
- var days:Number = Math.floor(hours / 24);
- //Storing the remainder of this division problem
- seconds %= 60;
- minutes %= 60;
- hours %= 24;
- //Converting numerical values into strings so that
- //we string all of these numbers together for the display
- var sec:String = seconds.toString();
- var min:String = minutes.toString();
- var hrs:String = hours.toString();
- var d:String = days.toString();
- if (days <= 0){
- d = "0";
- }
- //Setting up a few restrictions for when the current time reaches a single digit
- if (seconds <= 0){
- sec = "00";
- }
- else if (sec.length < 2) {
- sec = "0" + sec;
- }
- if (minutes <= 0){
- min = "00";
- }
- else if (min.length < 2) {
- min = "0" + min;
- }
- if (hours <= 0){
- hrs = "00";
- }
- else if (hrs.length < 2) {
- hrs = "0" + hrs;
- }
- //Stringing all of the numbers together for the display
- var time:String = d + ":" + hrs + ":" + min + ":" + sec;
- //Setting the string to the display
- time_txt.text = time;
- }
- MyClickTagButton.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);
- function fl_ClickToGoToWebPage(event:MouseEvent):void
- {
- navigateToURL(new URLRequest("http://www.newcountry94.com/ConcertsandShows/Details.aspx?EventID=201032"), "_top");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement