# Countdown timer with MovieClips in AS3

**URL:** <https://forum.kirupa.com/t/countdown-timer-with-movieclips-in-as3/305184>\
**Category:** flash\
**Created:** [February 20, 2010, 3:57pm UTC](https://forum.kirupa.com/t/countdown-timer-with-movieclips-in-as3/305184 "2010-02-20T15:57:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ale001](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@ale001](https://forum.kirupa.com/u/ale001)\
**Post date:** [February 20, 2010, 3:57pm UTC](https://forum.kirupa.com/t/countdown-timer-with-movieclips-in-as3/305184/1 "2010-02-20T15:57:49Z")

</div>

Hi everybody,  
I’m quite new to Flash, so hopefully this isn’t a stupid question. I just saw the Senocular’s tutorial here about making a date countdown timer with MovieClips.

I need a countdown timer with MovieClips for a project, but it has to be in ActionScript3 in a class. I have 1 week trying this, please some help.

Is there anybody who could help me?, please ☹

1000 Thanx!

This is the code in AS2 from Senocular tutorial that i want to pass to AS3 in a class:

currentDate = new Date();  
thisYear = currentDate.getFullYear();  
eventDate = new Date(thisYear, 11, 25);  
eventMillisecs = eventDate.getTime();

counter.onEnterFrame = function()  
{  
currentDate = new Date();  
currentMillisecs = currentDate.getTime();

```
this.msecs = eventMillisecs - currentMillisecs;
     
this.secs = Math.floor(this.msecs/1000); 
this.mins = Math.floor(this.secs/60); 
this.hours = Math.floor(this.mins/60);
this.days = Math.floor(this.hours/24);

this.msecs = string(this.msecs % 1000);
this.secs = string(this.secs % 60);
this.mins = string(this.mins % 60);
this.hours = string(this.hours % 24);
this.days = string(this.days);

while (this.msecs.length &lt; 3) this.msecs = "0" + this.msecs;
if (this.secs.length &lt; 2) this.secs = "0" + this.secs;
if (this.mins.length &lt; 2) this.mins = "0" + this.mins;
if (this.hours.length &lt; 2) this.hours = "0" + this.hours;
while (this.days.length &lt; 3) this.days = "0" + this.days;

for(movie in this)
{
   if (this[movie]._parent == this) this[movie].evaluateFrameFrom(this);
}

```

};

MovieClip.prototype.evaluateFrameFrom = function(variableClip)  
{  
var nameArray = this._name.split("_");  
var numberSet = variableClip[nameArray[0]];  
var character = number(nameArray[1]);  
var frame = 1 + number(numberSet.charAt(character));  
if (this.\_currentframe != frame) this.gotoAndStop(frame);  
};
