# Count Up Script

**URL:** <https://forum.kirupa.com/t/count-up-script/318015>\
**Category:** flash\
**Created:** [January 8, 2011, 1:15am UTC](https://forum.kirupa.com/t/count-up-script/318015 "2011-01-08T01:15:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dreadrocky](https://avatars.discourse-cdn.com/v4/letter/d/d26b3c/32.png) [@dreadrocky](https://forum.kirupa.com/u/dreadrocky)\
**Post date:** [January 8, 2011, 1:15am UTC](https://forum.kirupa.com/t/count-up-script/318015/1 "2011-01-08T01:15:44Z")

</div>

Okay so I am trying to make a simple count up flash project.  
I am still very new to flash. But I’ve done count ups before.  
It took me awhile but I finally got rid of ALL the errors, but yet  
the dynamic text I have setup is not showing anything.

Could someone help me using the script bellow?

```auto

    var today:Date = new Date();
    var currentYear = today.getFullYear();
    var currentTime = today.getTime();
    
    var targetDate:Date = new Date(2010,9,18);
    var targetTime = targetDate.getTime();
    
    var timeLeft = currentTime-targetTime;
    
    var sec = Math.floor(timeLeft/1000);
    var min = Math.floor(sec/60);
    var hrs = Math.floor(min/60);
    var totaldays = Math.floor(hrs/24);
    
    var months = Math.floor(totaldays/30);
    var odd = Math.floor(months*30);
    var days = totaldays - odd;
    if (months>11){
        var years = Math.floor(months/12);
        var NegYears = Math.floor(years*12);
        var month = NegYears - months;
    }
    
    txtyear.text = years;
    txtmonth.text = month;
    txtdays.text = totaldays;

```
