Jump to content

TEXT Countdown Timer


iyeru42

Recommended Posts

I want to countdown to a specific date. Problem is, kirupa uses images, I want to use dynamic text. Plus, I want everything Internally defined, nothing from HTML/XML/PHP or the URL to cause a different date to be counted down to.ActionScript 2.0 would also be preferred.

Link to comment
Share on other sites

Create a dynamic text field and give it an instance name. You can use setTimeout to run a function every second. Each time the function runs get the current date and time and calculate the difference between that and the target date and time and write the text to the dynamic text field.

Link to comment
Share on other sites

Create a dynamic text field and give it an instance name. You can use setTimeout to run a function every second. Each time the function runs get the current date and time and calculate the difference between that and the target date and time and write the text to the dynamic text field.
How would I do that with code? I'm sorry, but I'm not used to stuff like that. I do basic stuff like stop, play, gotoAndplay, etc. I don't mess with setTimeout (but I know what it does.)
Link to comment
Share on other sites

I don't have access to the Flash help file right now so I can't be much help until next week. But you can do it yourself. Hit F1 in Flash and open the Actionscript Language Reference, then Actionscript Classes and look up the Date object and the TextField object. There are examples to do everything.I'm not sure if Flash supports setTimeout or setInterval, it only supports one, I think it's setInterval. Do a search for setInterval in the help file, but this is how you set and clear an interval:

var nr = 0;var int_id = setInterval(test, 1000); // run test every 1000msfunction test(){  nr++;  trace("test: " + nr);  if (nr == 10) // stop after 10 calls	clearInterval(int_id);}

Link to comment
Share on other sites

Nevermind; I'll just use kirupa's and replace the images with TEXT rather than using dynamic text fields. External stuff causes undesired extra space wasted, I don't want that.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...