|
|||
|
I've made a count-up clock. However, I'm trying to get it to work off another
timezone and am having a few problems. Below is the code I've been working with. I need the clock to display 12 hours ahead and am unsure as to how to do this. Also, when it reaches a certain date in the future, I need it to then play another section off the timeline and stop. Please, any insight is very appreciated!! |
| Sponsored Links |
|
|||
|
I can not find a way to add 12 to the clock but you just take 12 off the date
and time, this is my counter and it's my birthday 14 sept so I set it 12 hours early var ABC:Number = 1 onEnterFrame = function () { var today ate = new Date();var currentYear = today.getFullYear(); var currentTime = today.getTime(); var myHours = today.getHours(); var myMinutes = today.getMinutes(); var mySeconds = today.getSeconds(); if(myHours<10){ myHours="0"+myHours } if(myMinutes<10){ myMinutes="0"+myMinutes } if(mySeconds<10){ mySeconds="0"+mySeconds } var targetDate ate = new Date(2008,9,13,12);var targetTime = targetDate.getTime(); var timeLeft = targetTime - currentTime; var sec = Math.floor(timeLeft/1000); var min = Math.floor(sec/60); var hrs = Math.floor(min/60); var day = Math.floor(hrs/24); var counter:String = "0:00:00:00"; sec = String(sec % 60); if (sec.length < 2){; sec = "0" + sec; } //end min = String(min % 60); if (min.length < 2){; min = "0" + min; } //end hrs = String(hrs % 24); if (hrs.length < 2){; hrs = "0" + hrs; } //end day = String(day); if (timeLeft <= 0){; counter = "0:00:00:00"; ABC = 0 }//end else{ counter = day + ":" + hrs + ":" + min + ":" + sec; } //end theTime_txt.text=myHours+":"+myMinutes+":"+mySecon ds; time_txt.text = counter; }// end end //Put this in frame 2// if(ABC <= 0){; gotoAndPlay(3); } else gotoAndPlay(1); //put this in frame 3// //and have what you want to happen// stop(); |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise