# How can I properly reset variables in this function?

**URL:** <https://forum.kirupa.com/t/how-can-i-properly-reset-variables-in-this-function/311773>\
**Category:** flash\
**Created:** [July 16, 2010, 4:32am UTC](https://forum.kirupa.com/t/how-can-i-properly-reset-variables-in-this-function/311773 "2010-07-16T04:32:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![threat45](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@threat45](https://forum.kirupa.com/u/threat45)\
**Post date:** [July 16, 2010, 4:32am UTC](https://forum.kirupa.com/t/how-can-i-properly-reset-variables-in-this-function/311773/1 "2010-07-16T04:32:22Z")

</div>

Hi Community,

Trying to work on a solution to a problem. I have 3 input fields, min:sec:frame (mval,sval,fval)

when it is triggered, it works fine the first time. I clear out the variables in the script below but it doesnt work properly. It comes back as not a number (NaN)

here is my function:

```php
gotoFrame.onRelease = function()
{
    if (mval == null)
    {
        mval = 0;
    }
    if (sval == null)
    {
        sval = 0;
    }
    if (fval == null)
    {
        fval = 0;
    }

    var numberOfFrames:Number = Math.round(24 * sval) + Math.round(1440 * mval) + Math.round(fval);
    trace("numberOfFrames is: " + numberOfFrames); // <<<NaN second time around

    mc.gotoAndPlay(numberOfFrames);
    var mval = null;
    var sval = null;
    var fval = null;
    var numberOfFrames:Number = null;
    inputMinute.text = "";
    inputSecond.text = "";
    inputFrame.text = "";
    resetTime();
};

```

Any suggestions to point me in the right direction? Thanks for looking!

A
