Countdown On Server Time
I used sen's most all mighty powerful Date Countdown tutorial. Everything works perfect.
I would be planning on using this for a release of a site type of thing where when it hits the exact time it will go to the site page, which I want to stay hidden. But I don't want users to be able to change their system clock to make the countdown end. How can I get around that security problem and have it run off of the server clock or something of the sort?
Get what I am trying to say?
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 08-19-2003, 09:02 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Countdown Time + Internet Time Server
Hi everyone. Im a noobie and trying to learn Flash and Actionscript.
I started with making some preloaders and advanced preloaders, now I want to learn to make a countdown to a specific date.
I have searched a lot after tutorials after a countdown but found some bugs.
I saw a countdown that was delay with 5 seconds. I mean, when I saw the time of my clock on the computer and the countdown on the site, it was delayed. I searched here and found this from a guy. I just copy his text and hope someone can tell me how to make it, or where to find the tutorial for AS3. (flash cs4) and that guy didnt get any help by the way...
Thanks a lot.
"I want to create a countdown timer which displays the same time for everybody in spite of their different time zones. I'd like to know how to get time and date from an Internet time server (such as time.windows.com, time.nist.gov, which is free to access) or, if not possible, how to get the time zone from the PC the SWF is running in."
[HELP] Countdown With Server Time
I just went through this tutorial on how to create a countdown timer with actionscript. It works great but I'm not sure just how to go about modifying the code so that it pulls from the servers time instead of the users time. Anyone able to help me out on this one?
I've attached the .fla
Thanks in Advance.
Countdown Using Time From My Comp- Not Server - How ?
I am using a tutorial from kirupa.com about a countdown to a certain date using the time acquired from the server. How would I do this as my desktop? In this case I want to make a desktop the is the countdown to
GRADUATION!!! WOOHOOO!!!
The code uses getMonth and all- I assume it could be done from the HD...right?
find the page here.
Getting Server Time For Countdown Clock
Hi,
I am using a countdown clock that counts down to a specified date in the future, but it takes the time from the system clock. Is there a way to get the time from a GMT timeserver? (or at the very least take the server time)
The code as it stands at the moment:
Code:
onClipEvent (load) {
countdown = "yes";
// Target Time Information
tyear = 2005;
tmonth = 10;
tday = 23;
thours = 6;
tminutes = 00;
tseconds = 00;
//
}
onClipEvent (enterFrame) {
if (countdown == "yes") {
mon = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
daysinmonth = ["31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31"];
now = new Date();
nyear = now.getFullYear();
nmonth = mon[now.getMonth()];
ndays = daysinmonth[now.getMonth()];
nday = now.getDate();
nhours = now.getHours();
nminutes = now.getMinutes();
nseconds = now.getSeconds();
// Year Code
ryear = tyear-nyear;
// Month Code
if (tmonth>=nmonth) {
rmonth = tmonth-nmonth;
} else {
ryear = (tyear-nyear)-1;
rmonth = (12-nmonth)+tmonth;
ryear = ryear-1;
}
// Day Code
if (tday>=nday) {
rday = tday-nday;
} else {
rday = (ndays-nday)+tday;
rmonth = rmonth-1;
if (rmonth<0) {
ryear = ryear-1;
rmonth = 12+rmonth;
}
}
// Hour Code
if (thours>=nhours) {
rhours = thours-nhours;
} else {
rhours = (24-nhours)+thours;
rday = rday-1;
if (rday<0) {
rmonth = rmonth-1;
rday = Number(ndays)+Number(rday);
if (rmonth<0) {
ryear = ryear-1;
rmonth = 12+rmonth;
}
}
}
// Minute Code
if (tminutes>=nminutes) {
rminutes = tminutes-nminutes;
} else {
rminutes = (60-nminutes)+tminutes;
rhours = rhours-1;
if (rhours<0) {
rday = rday-1;
rhours = 24+rhours;
if (rday<0) {
rmonth = rmonth-1;
rday = Number(ndays)+Number(rday);
if (rmonth<0) {
ryear = ryear-1;
rmonth = 12+rmonth;
}
}
}
}
// Seconds Code
if (tseconds>=nseconds) {
rseconds = tseconds-nseconds;
} else {
rseconds = (60-nseconds)+tseconds;
rminutes = rminutes-1;
if (rminutes<0) {
rhours = rhours-1;
rminutes = 60+rminutes;
if (rhours<0) {
rday = rday-1;
rhours = 24+rhours;
if (rday<0) {
rmonth = rmonth-1;
rday = Number(ndays)+Number(rday);
if (rmonth<0) {
ryear = ryear-1;
rmonth = 12+rmonth;
}
}
}
}
}
// Countdown Checker
if (ryear<0) {
disyear = 0;
dismonth = 0;
disday = 0;
dishours = 0;
disminutes = 0;
disseconds = 0;
discountdown = "no";
this.play();
countdown = "no";
} else {
// Update Clock Check
if (ryear ne year) {
year = ryear;
if (year<10) {
this.years.years.disyear = "0"+year;
} else {
this.years.years.disyear = year;
}
this.years.play();
}
if (rmonth ne month) {
month = rmonth;
if (month<10) {
this.months.months.dismonth = "0"+month;
} else {
this.months.months.dismonth = month;
}
this.months.play();
}
if (rday ne day) {
day = rday;
if (day<10) {
this.days.days.disday = "0"+day;
} else {
this.days.days.disday = day;
}
this.days.play();
}
if (rhours ne hours) {
hours = rhours;
if (hours<10) {
this.hour.hour.dishours = "0"+hours;
} else {
this.hour.hour.dishours = hours;
}
this.hour.play();
}
if (rminutes ne minutes) {
minutes = rminutes;
if (minutes<10) {
this.minute.minute.disminutes = "0"+minutes;
} else {
this.minute.minute.disminutes = minutes;
}
this.minute.play();
}
if (rseconds ne seconds) {
seconds = rseconds;
if (seconds<10) {
this.second.second.disseconds = "0"+seconds;
} else {
this.second.second.disseconds = seconds;
}
this.second.play();
}
}
}
}
Countdown Clock With *server* Time
Argh! I'm trying to make a countdown clock to put on a website (showing days/hrs/mins/secs left until a product release) in Flash MX but this "#¤(#"#)! Date stuff in Flash is useless since it grabs the time from the client side. How do I get the current date/time from the server and get it into Flash?
I tried literally hundreds of searches on Google (variations on Flash+MX+server side time+countdown+clock+world time+world clock+blah blah blah) but I either find nothing relevant or fancy samples and scripts that involve ASP/PHP/SSI/Whatever, with analog dials and multiple clocks and other distractions.
I just want a simple digital countdown clock based on the CET time on my server. Anyone?
Thanks in advance!
Server Countdown
http://www.kirupa.com/developer/mx/countdown2.htm i went through this tutorial i even made my own work counter but i'm stumbed on the server portion doesn't go into to much detail and when i downloaded the source uploaded it to a host to try it out and i don't get anything no numbers no nothing? anybody no what i'm doing wrong?
Countdown Clock From Server...
I´ve followed the countdown tutorial found here but I have to make the clock follow the server clock instead of the user´s computer clock. How to do it?
Countdown - Get Date From Server With Asp?
Hi,
I have successfully managed to follow and implement the flash date countdown timer tutorial given here: http://www.kirupa.com/developer/mx/countdown.htm
However I need to get the time from my server rather than the client so that everyone see's the same time and nobody can view the rest of the movie before the deadline has been reached.
Instructions are given to get the tiome from the server using PHP, however our website runs on asp.net so i cannot use this PHP script.
I know I can call the date from my server on an aspx page with:
<% dteDate = Now %>
<%=dteDate %>
Which displays as:
19/03/2007 12:40:29
Is it possible to pull that into the countdown? If so where do I need to start?
Thanks.
Another Countdown From Server Issue
Hi everyone,
I have done some searches but non of them give a a solution.
I have donwloaded and tested these 2 zip files on the server.
http://www.kirupa.com/forum/showthread.php?t=50817 (countdownserver.zip)
and
http://www.kirupa.com/developer/mx/countdown2.htm (servercountdown.zip)
I tested on my server and confirmed that I am able to get the server time. However, when I change the client machine (PC timezone), the countdown time will change as well. I thought it won't make any different even I have changed the client machine's timezone because the offset will base on server time.
May I know what I have done wrong? Am I in the right track?
Hope any of you can help. Thanks!
Countdown Clock From Server...
I´ve followed the countdown tutorial found here but I have to make the clock follow the server clock instead of the user´s computer clock. How to do it?
Countdown Script: Server Version
On request by DDD, here's a different version of my countdown script.
The difference is that this uses the webservers time, not the clients. This prevents clients from making the script malfunction.
(The old option to use client time is still avalible in the script.)
Have fun with it!
Countdown Timer...need It To Sync To Server.
so im making a timer like this one...
http://www.kirupa.com/developer/mx/countdown.htm
but i would like it to pick up the time from a time server...i believe it picks the time up locally and i need to sync it from a server...any ideas?
Flash, ASP, Server Countdown Timer
Hi i have read the article you have on the countdown timer and all is wrking well but i am wanting it to be on a asp server not php as the file download is.
i am struggling to change the PHP to asp and stll work, can anyone help.
CHeers SLuap
http://www.kirupa.com/developer/mx/countdown2.htm
Countdown Script: Server Version
On request by DDD, here's a different version of my countdown script.
The difference is that this uses the webservers time, not the clients. This prevents clients from making the script malfunction.
(The old option to use client time is still avalible in the script.)
Have fun with it!
Clock Showing Server Time And Different Time Zones.
Hey all,
I have a clock that shows time according to local pc time but i want it to show according to the server. I have referred to all the Forum threads for the same but couldn't get it done. Is there any server side script to be written..if yes i can't cause i don't know any sever side scripts.I M a Designer and not a Programmer yet i can do action scripting a bit...if anyone can help please thanks in advance
whenever i change the time on my pc the time displayed gets changed.
Here's the code:
MyDate = new Date();
hours = MyDate.getHours();
minutes = MyDate.getMinutes();
seconds = MyDate.getSeconds();
hourAdjust = 0;
hours = hours+hourAdjust;
if (hours>24) {
hours = 0+(hours-24);
} else if (hours<0) {
hours = 24+hours;
}
tellTarget ("hours") {
_rotation = ((../:hours*30)+(../:minutes*.5));
}
tellTarget ("minutes") {
_rotation = ((../:minutes*6)+(../:seconds*.1));
}
tellTarget ("seconds") {
_rotation = (../:seconds*6);
}
gotoAndPlay(1);
Also can we pass an external value for .getHours(); syntax from an html?
Please help it urgent..
Flash Countdown Ticker Using Server Date
Hi,
I am making a countdown ticker that would get the current server date & time and then calculate the remaining time from a target date.
I am using a PHP file to output the current server date & time. Then I use the Flash's loadvars function to get the result and format it as a Date field. However, when I trace for remaining days using targetDate-serverDate, I get NaN as the result.
Any help will be greatly appreciated. Below is the code for my flash script as well as the php script.
Flash Code:
Code:
onClipEvent (load) {
myVars = new LoadVars();
// call the load method to load my php page
myVars.load("http://localhost/getServerDate.php");
// once vars have been loaded:
myVars.onLoad = function(success) {
if (success) {
for (var prop in this) {
var nowDate:Date = myVars.serverDate;
}
} else {
trace(" Error loading variables ");
}
// trace (nowDate);
target_date = new Date(2008, 3, 29, 13, 20, 59);
days = Math.floor((target_date-nowDate)/1000/60/60/24);
trace (days);
};
}
PHP Code:
Code:
<?php
// Set default timezone
//date_default_timezone_set('Asia/Calcutta'); // for PHP5
putenv("TZ=Asia/Calcutta"); // for PHP 4
$now = date("Y, n, j, G, i, s");
print "&serverDate=$now&";
?>
Thanx in advance,
Sridhar
www.signature.co.in
Time Countdown
Anyone know a good code to make a countdown to a certain date!
days, hours, minutes, seconds etc...
Flv Time Countdown
I've pieced together this code from formulas I've found. I have it currently displaying how much time has been played and the total time of the flv. However, I would like for this to countdown instead of count up. Any ideas on how I would do this? Here is my code so far.
Thanks,
Saveth
Code:
var totalHours:Number;
var totalMinutes:Number;
var totalSeconds:Number;
var hours:Number;
var minutes:Number;
var seconds:Number;
function videoStatus() {
totalHours = Math.floor(duration/3600);
totalMinutes = Math.floor(duration/60)-(totalHours*60);
totalSeconds = Math.round(duration%60);
hours = Math.floor(netS.time/3600);
minutes = Math.floor(netS.time/60)-(hours*60);
seconds = Math.round(netS.time%60);
trace(totalHours + " hours: " + totalMinutes + " minutes: " + totalSeconds +" seconds");
trace(hours + " hours: " + minutes + " minutes: " + seconds +" seconds");
}
Countdown Time. HELP
I’m fairly NEW to the forum but I have been checking out the site for sometime now and I have to say that it’s been very helpful. Well, the reason that I’m posting this thread is because I have been trying to create a Date Countdown Time for a special event that’s occurring on August 4, 2004 @ 7:05 PM Eastern Time (Vacation Trip to California) and I haven’t been able to get the coding correctly. Can someone please help me finish this countdown timer? I would extremely helpful and greatly appreciated.
Here are the graphics I created in Photoshop…
And here is what I would like the Countdown Timer to look like when it’s finished but obviously counting down to August 4, 2004 @ 7:05... hehehe
By the way, the “Off to Cali *****es” is what I would like to display when the date/time has been reached. Thanks again guys…
Flv Time Countdown
I'm trying to figure out how to get the time remaining of an flv.
I currently can get the total time and the current time. Any ideas?
Code:
var totalHours:Number;
var totalMinutes:Number;
var totalSeconds:Number;
var hours:Number;
var minutes:Number;
var seconds:Number;
function videoStatus() {
totalHours = Math.floor(duration/3600);
totalMinutes = Math.floor(duration/60)-(totalHours*60);
totalSeconds = Math.round(duration%60);
hours = Math.floor(netS.time/3600);
minutes = Math.floor(netS.time/60)-(hours*60);
seconds = Math.round(netS.time%60);
trace(totalHours + " hours: " + totalMinutes + " minutes: " + totalSeconds +" seconds");
trace(hours + " hours: " + minutes + " minutes: " + seconds +" seconds");
}
Server Time Insted Of Client Time
hello flashers.
help needed.
working on a project where on the top left corner of the screen i display
the current date and a clock.
they are the user machine's date and time.
i want to display the server time rather then the user's machine time.
how can i acomplish this task?
thanks
piny.
Server Time As Opposed To System Time
hello, i'm currently working on a count down timer to the end of semsester for a website i am making for school. My problem is that the way i have my movie scripted at the moment it retrieves the time from the users computer. is there any way to have it retrieve the accurate time from somewhere else other than the users computer, so that it doesn't matter what time the user has their computer to, it will still be accurate?
[FMX] Obtaining The Server Time, Not Client Time?
Hi, does anyone know if it is possible to obtain the time (by functions similar to getSeconds) of the server the flash file is hosted on, instead of the client who is viewing the movie?
Thing is, I have a very simple clock that displays the time in New Zealand (where I will be going), but it only display the time correctly for GMT+1 right now. If a client from New Zealand or US connects, they will see the wrong time :/
Any way to fix this?
So right now i use:
Code:
newtime = timedate.getSeconds() + 3600*11;
timedate.setSeconds(newtime);
Date And Time Countdown
Is it possible to create a countdown to a certain date and time (for example Monday 8th April 9.00am - 74 days, 18 hrs 10mins 34secs) and to have this as a realtime backwards clock.
Thanks
Rob
Countdown Time Bar STOPeaBle?
hello everybody!!!
Does anybody know how to do a time bar stoppeable (it's for a game) and that it can start again from the place it was??
I'm creating a video game and there's a time bar. Time finishes and game does. BUT, when you get killed, a message appears and you start again (if you still have lives). But my actual bar starts counting time from zero!!!
I WANT TO KEEP THE CURRENT TIME LEFT!!
How could I do????? Pleeaaaaaase?? Any Idea??
Thanks!!!
http://www.hombredequeso.com
Countdown Related To Time Of Day
Hi everybody,
Got a question. I managed to get a countdown working, starting from 750 (counting down with the rate of a second).
Code looks like this:
------------------------------------------------------------
_root.onEnterFrame = function() {
time = Math.floor(getTimer()/1000);
displayTime = 750-time;
if (displayTime<=50) {
delete _root.onEnterFrame;
}
};
------------------------------------------------------------
Now here comes the tricky part.
I would like to make 4 different countdown rates depending on the time of day.
What I mean is:
- 1 countdown rate, counting down every second playing between 09.00 hours and 15.00 hours
- 1 countdown rate, counting down every 2 seconds playing between 15.00 hours and 21.00 hours
- 1 countdown rate, counting down every 3 seconds playing between 21.00 hours and 03.00 hours
- 1 countdown rate, counting down every 4 seconds playing between 03.00 hours and 08.00 hours
Is there any way to check the time and make some kind of if/else statement in order to get the right function working at the right time???
Maybe splitting it into 4 different MC's.., (replacing the onEnterFrame with onClipEvent) and calling them on the specified time..?
Would really appreciate it if some one could tell me how to get this working.
Thanks in advance!
Eva
How To Show Countdown Time
Hi there again...
I'm using this code for my game timer. That works fine!
Code:
function timer(){
seconds=seconds-1;
if (seconds < 0) {
clearInterval(myTimer);
gotoAndPlay("Scene 2", 1);
}
}
myTimer=setInterval(timer, 10000);
But I'd like to know how I can show the gamer how many seconds he has left (in a text field). I've looked in the tutorials but I didn't find my anwser.
Anyone an idea?
Leon
Non Time-based Countdown
Hey everyone,
I need to find a tutorial or guide that will allow me to make a countdown to begin at 5 minutes from when the movie is started. I've found 'count'less time based ones (birthdays, movie releases, etc) but none that will start at a time based on when the movie starts.
I just need a timer to go from 5:00 to 0:00 and then advance to another frame.
Any help is greatly appreciated.
thanks!
p.s. I've tinkered with http://www.kirupa.com/developer/mx/countdown2.htm but it's not what I need at all - it's time based
Countdown Timer For Date And Time
I am trying to make a countdown timer and I dont know how to make the date count down. Can someone help me correct my script. Help would be greattly appricieated.
This is my script:
// GetDate Mechanism
myDate = new Date();
seconds = myDate.getSeconds();
minutes = myDate.getMinutes();
hours = myDate.getHours();
days = myDate.getDay();
seconds2 = 59-seconds;
minutes2 = minutes-11;
hours2 = 13-hours;
// I am wondering what this is for. Please help???
if (length(minutes2) == 1) {
minutes2 = "0"+minutes2;
}
if (length(seconds2) == 1) {
seconds2 = "0"+seconds2;
}
// Information To Textbox
hoursLeft = (hours2);
minsLeft = (minutes2);
secsLeft = (seconds2);
Setting Date/time Countdown
I know how to set the date and time in flash of someone's computer when the swf loads. but what i want to do is set a destination time...say, next friday, 5/3/02, so when a user opens the html page flash will read their date and time and determine how many hours and minutes there will be till 5/3/02 and display it. hope that makes sense and someone can help. Thanks!
Old Time Movie Reel Countdown
Can anyone point me towards a tutorial or just a movie example of an old time movie reel countdown. Like a black and white 5,4,3,2,1 thing. I have one made, but it lacks the authentic look and feel so I need some pointers. I saw one of these quite some time ago, and now I can't locate anything on it.
thanks!
Countdown Timer Time Zone
i am trying to make a countdown timer the is based in a time zone. So it will be the same amount of time left all around the world. I want to make it 11pm est (GMT-5). Is there any way to do this.
How To Create A Time Limit Or Countdown
I'm creating a simple game in Flash and (amazingly enough!) I havn't found a single way to create a time limit in the game (as in a timer in the corner counting down the time you have left to finish the level (think Mario games!))
Anyone have an answer?
Thanks!!
Help On Time Limit Countdown Actionscript
hello.... i'm new here...
sorry if i ask questions that been posted b4, but i js cant find one actionscript which teaches how to make a time limit countdown.
such as in my game the characters need to do something in 30seconds. And so i need a time limit of 30seconds.....
pls help anyone? or need me explain further?
thx
Adding Time To A Countdown/timer.
Hey guys, need a little help with something. I'm making a game and it has a 20sec timer in it and I want to make a button/powerup thing that adds 5 seconds to the timer when you press it.
I'm currently using: -
Code:
timerBTN.onPress = function(){
_root.countdown += 5;
gotoAndPlay (2);
}
stop();
This doesn't work, is there something wrong with my code, or is my method not the best? Any help would be really helpful.
Thanks
Countdown Timer // Adjusting The Time
Hi,
I used the Cowntdown timer from this page
http://www.kirupa.com/developer/mx/countdown2.htm
I wanted to know how can I adjust the time. For example, I want to change the ending time to 8.00 am, what do I need to change in the code for it to "explode" at 8.00am?
thank you.
Regards,
The RedDeviL
Countdown Timer That Depends On The Time
Thanks for helping out with my question about the image changing with time. Now I'd like to make a countdown timer that counts down to 4:30PM and restarts each day. I've been trying to define variables for currentDay and Month, etc so that it "restarts" each day, but I'm still having some problems.
I've gotten through a little bit of it, but I can't figure out why it seems to be counting up with negative numbers. I'm sure it has something to do with the
"var timeLeft" line, but can't figure it out.
I attached the file... could someone take a look at the actionscript?
Thanks!!!
Help On Time Limit Countdown Actionscript
hello.... i'm new here...
sorry if i ask questions that been posted b4, but i js cant find one actionscript which teaches how to make a time limit countdown.
such as in my game the characters need to do something in 30seconds. And so i need a time limit of 30seconds.....
pls help anyone? or need me explain further?
thx
Javascript [get Time] Countdown In Actionscript
I suck at scripting in general... just a foolish designer here. :P
I have a Javascript that countsdown to any given time/date. In this instance I'm using the New Year to count down to in seconds, minutes, hours, days and weeks. I will attach the JavaScript below this text, but my question is - How do I apply this javascript to flash? Do I need to convert it to actionscript? I thought I could just place the javascript on the first frame of the timeline and reference it from there by giving my variab;e text fields the corresponding var names, but even then I'm not exactly sure how to go about it. Like I mentioned, I'm a retarded designer, not a programmer, please bare with me.
Here is the script I'd like to use...
--------------------------------------
var eventdate = new Date("January 01, 2004 00:00:00 GMT");
function toSt(n) {
s=""
if(n<10) s+="0"
return s+n.toString();
}
function countdown() {
cl=document.clock;
d=new Date();
count=Math.floor((eventdate.getTime()-d.getTime())/1000);
if(count<=0)
{cl.days.value ="----";
cl.hours.value="--";
cl.mins.value="--";
cl.secs.value="--";
return;
}
cl.secs.value=toSt(count%60);
count=Math.floor(count/60);
cl.mins.value=toSt(count%60);
count=Math.floor(count/60);
cl.hours.value=toSt(count%24);
count=Math.floor(count/24);
cl.days.value=count;
count=Math.floor(count/7);
cl.weeks.value=count;
setTimeout("countdown()",500);
}
--------------------------------------------
thanks for any help or direction.
-t
How Do I Create A Countdown Not Base On Users Computer? (greenwich Meantime/server)?
Hi
I want to create a countdown timer but I don't want it to be reliant on the users computer.
Is there any way to do it using either something like Greenwich meantime?
Or if not, is there anyway to use the time of the server hosting the SWF?
I found some solutions for the later by searching but they depend on using PHP or ASP as well, which I don't have the option to do. In fact I have to do this purely using actionscript.
How To Convert This Countdown Actionscript To GetUTC-4 Time
How can I convert the script below to "getUTC - 4"; so I can set this countdown actionscript to eastern time zone?
Code:
this.onEnterFrame = function() {
var todaydate = new Date();
var currentYear = todaydate.getFullYear();
var currentTime = todaydate.getTime();
var targetDate = new Date(currentYear, 05, 19); // current end date April 19, 2007
var targetTime = targetDate.getTime();
var timeLeft = targetTime-currentTime;
var sec = Math.floor(timeLeft/1000);
var minTime = Math.floor(sec/60);
var hours = Math.floor(minTime/60);
var days = Math.floor(hrs/24);
hrs = (hrs%24);
days = days;
var counter = (hours+1);
txt1.text = counter;
if (counter < 0)
{
txt1.text="0";
}
trace (counter);
var plural="s";
txt2.text = plural;
if (counter < 2) {
txt2.text="";
}
trace (plural);
};
Movie TIMER With Total Time And Countdown
With so many timer scripts out there,
I'm wondering if anyone knows of a script/movie that does the basics:
- display the total time of a movie from the beginning.
- counts down to "zero" value as the movie progresses.
I'm looking to add this "timer" feature to a captivate movie (end product = swf) with the above functionality. Within the captivate movie is the standard control bar which consists of play, fast forward, rewind, stop, pause, etc. I would like to intergrate the timer with this control bar.
Example format for a 35 second movie: (beginning time to end) 00:00:35 - 00:00:00
Any advice or direction is greatly appreciated!
Thanks,
Date Countdown Timer: Specify Time Zone.
Hi.
I've been using your tutorial for a date countdown timer with great sucess, although now I realise because it took the date from the computer that is viewing it and because the event is counting to an event in India, it would be wrong because up until now, ive just put the date and time so obivously it would be wrong because it would be that time/date of that timezone. Is there anyway I can alter the actionscript for a specific timezone?
Thanks very much for your help.
How Do I Get The Time From An Internet Time Server?
I want to create a countdown timer which displays the same time for everybody in spite of their different time zones. I'd like to know how to get time and date from an Internet time server (such as time.nist.gov, which is free to access) or, if not possible, how to get the time zone from the PC the SWF is running in.
Any ideas?
Countdown Timer, Timezone Offset Stuck In Eastern Time
I have a countdown timer that will be used for events that happen locally central time, mountain time, etc. However, if someone on eastern or pacific time (or any variation of the 4 timezones) looks at the countdown timer, I want to make sure that it shows the time relative to their timezone.
I thought i could read the user's timezone offset (Date.getTimezoneOffset) and subtract from it the hardcoded timezone offset of the event (passed as a variable from XML depending on the event's "primary" timezone).
Am I getting the math here wrong? The "net" timezone offset from the user - the event timezone offsets SHOULD add into the countdown time.
However, Date.getTimezoneOffset, regardless of my Mac or PC timezone setting/time, keeps showing an Eastern timezone offset of 5 hours. What's going on?
The time is correct when I hardcode an event timezone offset to anything other than Eastern time. I think the problem is that it's not getting a user timezone offset OTHER than -5 hours for Eastern Time.
Code for the timer is here (assume that the target event timezone has been passed in):
Code:
this.onEnterFrame = function() {
var today:Date = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();
var currentOffset = today.getTimezoneOffset() * 60 * 1000;
var targetDate:Date = new Date(countTimeYear,countTimeMonth,countTimeDate,countTimeHour,countTimeMinute);
var targetTime = targetDate.getTime();
var targetOffset:Number;
switch(countTimeZone) {
case "eastern" :
targetOffset = 5;
break;
case "central" :
targetOffset = 6;
break;
case "mountain" :
targetOffset = 7;
break;
case "pacific" :
targetOffset = 8;
break;
default :
targetOffset = 5;
break;
}
targetOffset = targetOffset * 60 * 60 * 1000;
var totalOffset = targetOffset - currentOffset;
var timeLeft = targetTime - currentTime + totalOffset;
var millisec = Math.floor(timeLeft);
var seconds = Math.floor(timeLeft/1000);
var minutes = Math.floor(seconds/60);
var hours = Math.floor(minutes/60);
var days = Math.floor(hours/24);
millisec = String(millisec % 10);
seconds = String(seconds % 60);
if (seconds.length < 2) {
seconds = "0" + seconds;
}
minutes = String(minutes % 60);
if (minutes.length < 2) {
minutes = "0" + minutes;
}
hours = String(hours % 24);
if (hours.length < 2) {
hours = "0" + hours;
}
days = String(days);
if (days.length == 1) {
days = "000" + days;
} else if (days.length == 2) {
days = "00" + days;
} else if (days.length == 3) {
days = "0" + days;
}
if (timeLeft > 0) {
countdownTime = days + ":" + hours + ":" + minutes + ":" + seconds + "." + millisec;
} else {
countdownTime = "0000:00:00:00.0";
}
this.countdown_text.text = countdownTime;
}
Thoughts? Suggestions?
IronChefMorimoto
Countdown Timer, Timezone Offset Stuck In Eastern Time
I have a countdown timer that will be used for events that happen locally central time, mountain time, etc. However, if someone on eastern or pacific time (or any variation of the 4 timezones) looks at the countdown timer, I want to make sure that it shows the time relative to their timezone.
I thought i could read the user's timezone offset (Date.getTimezoneOffset) and subtract from it the hardcoded timezone offset of the event (passed as a variable from XML depending on the event's "primary" timezone).
Am I getting the math here wrong? The "net" timezone offset from the user - the event timezone offsets SHOULD add into the countdown time.
However, Date.getTimezoneOffset, regardless of my Mac or PC timezone setting/time, keeps showing an Eastern timezone offset of 5 hours. What's going on?
The time is correct when I hardcode an event timezone offset to anything other than Eastern time. I think the problem is that it's not getting a user timezone offset OTHER than -5 hours for Eastern Time.
Code for the timer is here (assume that the target event timezone has been passed in):
Code:
this.onEnterFrame = function() {
var today:Date = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();
var currentOffset = today.getTimezoneOffset() * 60 * 1000;
var targetDate:Date = new Date(countTimeYear,countTimeMonth,countTimeDate,countTimeHour,countTimeMinute);
var targetTime = targetDate.getTime();
var targetOffset:Number;
switch(countTimeZone) {
case "eastern" :
targetOffset = 5;
break;
case "central" :
targetOffset = 6;
break;
case "mountain" :
targetOffset = 7;
break;
case "pacific" :
targetOffset = 8;
break;
default :
targetOffset = 5;
break;
}
targetOffset = targetOffset * 60 * 60 * 1000;
var totalOffset = targetOffset - currentOffset;
var timeLeft = targetTime - currentTime + totalOffset;
var millisec = Math.floor(timeLeft);
var seconds = Math.floor(timeLeft/1000);
var minutes = Math.floor(seconds/60);
var hours = Math.floor(minutes/60);
var days = Math.floor(hours/24);
millisec = String(millisec % 10);
seconds = String(seconds % 60);
if (seconds.length < 2) {
seconds = "0" + seconds;
}
minutes = String(minutes % 60);
if (minutes.length < 2) {
minutes = "0" + minutes;
}
hours = String(hours % 24);
if (hours.length < 2) {
hours = "0" + hours;
}
days = String(days);
if (days.length == 1) {
days = "000" + days;
} else if (days.length == 2) {
days = "00" + days;
} else if (days.length == 3) {
days = "0" + days;
}
if (timeLeft > 0) {
countdownTime = days + ":" + hours + ":" + minutes + ":" + seconds + "." + millisec;
} else {
countdownTime = "0000:00:00:00.0";
}
this.countdown_text.text = countdownTime;
}
Thoughts? Suggestions?
IronChefMorimoto
Dear Lord, Help Me Create A Countdown Timer To Exact Time (not Just Date)
Hey guys,
For the life of me, how the heck can a newbie like me in coding, create a friggin' timer to the exact time. I found billions of tutorials to countdown to a day, but NOBODY can provide a sample to countdown to a date and time (i.e. Dec. 25 @ 8PM).
I need this to countdown to a TV show's premier. And I'm a designer not a coder... so there has to be a FLA file out there that I could snag and just update the graphics and plug in a time and date, and then it counts down once I make a SWF? Anybody?
=)))))) Keep in mind, I've Googled for hours.
|