Jump to content
iyeru42

TEXT Countdown Timer

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.

Share this post


Link to post
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.

Share this post


Link to post
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.)

Share this post


Link to post
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);}

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...