# \[AS\]Need help with calculating a string value

**URL:** <https://forum.kirupa.com/t/as-need-help-with-calculating-a-string-value/243292>\
**Category:** Uncategorized\
**Created:** [November 5, 2007, 2:58pm UTC](https://forum.kirupa.com/t/as-need-help-with-calculating-a-string-value/243292 "2007-11-05T14:58:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![josuason](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@josuason](https://forum.kirupa.com/u/josuason)\
**Post date:** [November 5, 2007, 2:58pm UTC](https://forum.kirupa.com/t/as-need-help-with-calculating-a-string-value/243292/1 "2007-11-05T14:58:34Z")

</div>

Hello,

I´ve used the countdown AS from Kiruba to list a value of days left until 2008.

```auto

stop();

currentDate = new Date();
thisYear = currentDate.getFullYear();

eventDate = new Date(thisYear, 11, 30);
eventMillisecs = eventDate.getTime();

counter_8.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.digit = string(this.days);
    
    while (this.digit.length < 5) this.digit = "0" + this.digit;

    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);
};

```

I want to calculate 1580 - (this.digit \* 4)

and have a new this.digit value of 1364.
