| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Flash Game Enthusiast
|
Hey guys,
I thougtht i would try to make a timer to count down to christmas. Only to find out that this is incredibly hard. I eventually found out a way to do it but its a bit rough. It wont count down 12 months once i get past the 25th of december. But it will do the job fine from the 1st of january. What i would like to see is someone else try it. My script was fairly long and im sure there would be an easier way. What im looking for is a couple of dynamic textboxes for months, days, hours, minutes and seconds untill christmas. Lets say its the 5th of march (my birthday). Instead of saying 9 months, 270 days (or whatever it might be) and so on, Im looking for 9 months, 26 days and so on. Good luck! P.S ill post my swf and fla when i get enough response to this thread. P.S.S By the time people come accross this post itll probibly be past christmas and we will all be playing around with our new versions of flash 8! Yay! See ya! |
|
|
|
|
|
#2 |
|
Oops I did it again
Join Date: Oct 2001
Location: Melbourne
Posts: 8,578
|
do you want to use the users system clock or something more reliable like a PHP date object?
__________________
Billy Online Galleries Free Flash Video Tutorials Photo Website Template Don't email or PM me questions... |
|
|
|
|
|
|
|
|
#3 |
|
TEAM INTERNET
|
Well it is past christmas, but make one for new years
I almost have it, this is just a test version ActionScript Code:
It doesnt quite work, by the way you have to draw the dynamic text box yourself and call it input ![]()
__________________
The author of windows file copy dialogue visits some friends: "I'm just outside of town so I should be there in about 15 minutes" "Actually it's looking more like 6 days" "No, wait, 30 seconds" |
|
|
|
|
|
#4 |
|
Dont set yourself on fire
|
when posting code in forums, i usually try to make it 100% copy-and-paste-able. for the dynamic text field, you can just create it with createTextField, then add the text to it with .text=
that way, beginners can try out your script with little or no flash expertise required. i like they script, btw.. i don't see too many people use modulo, and instead write a complex workaround for it. |
|
|
|
|
|
#5 |
|
TEAM INTERNET
|
I found the code buried in one of my 1000's of unfinished flash files.
__________________
The author of windows file copy dialogue visits some friends: "I'm just outside of town so I should be there in about 15 minutes" "Actually it's looking more like 6 days" "No, wait, 30 seconds" |
|
|
|
|
|
#6 |
|
Flash Game Enthusiast
|
incredible how some people can do that just effortlessly with about 20 lines of code and mine took 7 hours and about 100 lines of code. sorry but i dont have my source code here with me right now. ill post it next saturday hopefully. (14/1/2006). By the way i used modulo in my script too to work out if it was a leap year like this:
ActionScript Code:
I know i could have just done this: ActionScript Code:
Ive also noticed pros do almost everything in variables for a game so its easier to change. but i have to go hunting! |
|
|
|
|
|
#7 |
|
TEAM INTERNET
|
![]() 100 lines for a countdown timer, I dont know where this code came from, I dont remember writing it. Maybe I got it off a website and was modifying it.
__________________
The author of windows file copy dialogue visits some friends: "I'm just outside of town so I should be there in about 15 minutes" "Actually it's looking more like 6 days" "No, wait, 30 seconds" |
|
|
|
|
|
#8 |
|
Registered User
Join Date: Oct 2005
Posts: 8
|
I know this is more than a little late, but you do realize that technically we don't have a leap year every 4 years right? Technically it's:
All years divisible by 4, unless divisible by 100, unless divisible by 400. So basically, 1996 IS because it's divisible by 4 and NOT 100. 1900 is NOT because although it is divisible by 4, it is ALSO divisble by 100. 2000 IS...it's divisible by 4 (so yes), but ALSO by 100 (so no), but then it IS divisble by 400 (so yes again). Check wikipedia http://en.wikipedia.org/wiki/Leap_ye...ve_a_leap_year So, something more like this maybe: Code:
if (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)) {
leapYear = true;
} else {
leapYear = false;
}
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to modify this countdown timer code? | ickwong | ActionScript 2.0 | 4 | 11-13-2006 05:31 PM |
| Countdown Timer Problem | RatoN | ActionScript 2.0 | 8 | 11-27-2005 04:33 AM |
| please help! countdown timer problem | dafnabru | ActionScript 2.0 | 1 | 10-15-2005 03:36 PM |
| pause and resume timer countdown | meisme | ActionScript 1.0 (and below) | 0 | 03-31-2005 02:06 AM |
| I have a question about a countdown timer | thesilversliph | ActionScript 1.0 (and below) | 0 | 10-16-2002 03:02 PM |