# AS help

**URL:** https://forum.kirupa.com/t/as-help/262053
**Category:** flash
**Created:** [June 2, 2008, 11:11pm UTC](https://forum.kirupa.com/t/as-help/262053 "2008-06-02T23:11:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nohomedia](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@nohomedia](https://forum.kirupa.com/u/nohomedia)
#### Post date: [June 2, 2008, 11:11pm UTC](https://forum.kirupa.com/t/as-help/262053/1 "2008-06-02T23:11:07Z")

</div>

Trying to create a countdown timer and I used this tutorial… [http://www.oman3d.com/tutorials/flash/video/countdown.php](http://www.oman3d.com/tutorials/flash/video/countdown.php)

I’ve checked and checked the code and I can’t figure out why its not working. Here’s the code:

```auto
this.onEnterFrame = function() {
    
    var today:Date = new Date();
    var currentYear = today.getFullYear();
    var currentTime = today.getTime();
    
    var targetDate:Date = new Date(2008,5,29)
    var targetTime = targetDate.getTime();
    
    var timeLeft = targetTime - currentTime;
    
    var sec = Math.floor(timeLeft/1000);
    var min = Math.floor(sec/60);
    var hrs = Math.floor(min/60);
    var days = Math.floor(hrs/24);
    
	sec = string(sec % 60); 
    if (sec.length < 2) {
        sec = "0" + sec; 
    }
    min = string(min % 60);
    if (min.length < 2) {
        min = "0" + min;
    }
    hrs = string(hrs % 24);
    if (hrs.length < 2); {
        hrs = "0" + hrs;
    }
    days = string(days);
    
    var counter:String = days + ":" + hrs + ":" + min + ":" + sec;
    time_txt.text = counter;
    
}

```

And here are the errors I’m getting…

[QUOTE]1180: Call to a possibly undefined method string.

---

<div class="post-metadata">

### Author: ![nohomedia](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@nohomedia](https://forum.kirupa.com/u/nohomedia)
#### Post date: [June 3, 2008, 6:19am UTC](https://forum.kirupa.com/t/as-help/262053/2 "2008-06-03T06:19:05Z")

</div>

Thanks so much, that was it!
