# Question about countdown timer

**URL:** <https://forum.kirupa.com/t/question-about-countdown-timer/57951>\
**Category:** Uncategorized\
**Created:** [July 18, 2004, 9:55am UTC](https://forum.kirupa.com/t/question-about-countdown-timer/57951 "2004-07-18T09:55:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lol](https://avatars.discourse-cdn.com/v4/letter/l/5daacb/32.png) [@lol](https://forum.kirupa.com/u/lol)\
**Post date:** [July 18, 2004, 9:55am UTC](https://forum.kirupa.com/t/question-about-countdown-timer/57951/1 "2004-07-18T09:55:02Z")

</div>

Hey,

I was wondering if any one knows how to build a countdown timer.

I found a few tutorials about clocks and countdowns to a particular date etc. Though what I would like my website to preform things after a minute or two i.e. Suddenly play a tune or change the backdrop etc…

Would be most happy for any suggestions, links etc…

lol

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 18, 2004, 10:41am UTC](https://forum.kirupa.com/t/question-about-countdown-timer/57951/2 "2004-07-18T10:41:01Z")

</div>

you can use setInterval()…  
or if you want the time shown then use a simple date function and calculate whats left ie.

```auto
timeNow = new Date()
minLeft = targetMin - timeNow.getMinutes()

```

and make sure you sort it out so you dont get minus minutes etc…

Prophet.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 18, 2004, 12:22pm UTC](https://forum.kirupa.com/t/question-about-countdown-timer/57951/3 "2004-07-18T12:22:55Z")

</div>

Thanks to the prophet,

though a bit more infomation would help. This setInterval() does it go into a empty mc with onClipEvent(load) or on it’s own? How would I define the time would I use a (getTimer()/1000) for that?..

Again thanks a lot for you help…

lol

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 18, 2004, 1:58pm UTC](https://forum.kirupa.com/t/question-about-countdown-timer/57951/4 "2004-07-18T13:58:23Z")

</div>

did you check out the one by sen :sen: [http://www.kirupa.com/developer/mx/countdown.htm](http://www.kirupa.com/developer/mx/countdown.htm)  
it’s easy to follow along…explinational too…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 18, 2004, 2:45pm UTC](https://forum.kirupa.com/t/question-about-countdown-timer/57951/5 "2004-07-18T14:45:16Z")

</div>

Year, thanks it’s cool “should you want to countdown to Christmas, or maybe your birthday or even the release of a new movie…” But I would like to learn how to create a counter that start when you start the movie and after a minute or two plays a frame or changes a simbol etc. 🙂

Thanks macneilslt for your post.

lol

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 18, 2004, 6:54pm UTC](https://forum.kirupa.com/t/question-about-countdown-timer/57951/6 "2004-07-18T18:54:59Z")

</div>

One way of doing it:

```auto
onClipEvent (load) {
	//start the timer
	var stTime = getTimer();
}
onClipEvent (enterFrame) {
	//read the timer
	var curTime = getTimer();
	//get the elapsed time in seconds
	var elapsedTime = (curTime-stTime)/1000;
	//do something after 10 seconds
	if (elapsedTime>10) {
		//do your stuff
		//(optional to start again:)
		stTimer = getTimer();
	}
}

```

Put that on a (empty) movieclip;)

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 19, 2004, 6:01pm UTC](https://forum.kirupa.com/t/question-about-countdown-timer/57951/7 "2004-07-19T18:01:13Z")

</div>

lol scotty comes up with the goods once again 😉  
sorry i couldnt be more coherant but i was in a hurry wen posting… and may i say scottys method is much better 😉

Prophet.
