# Resetting A Timer On User Input

**URL:** <https://forum.kirupa.com/t/resetting-a-timer-on-user-input/220916>\
**Category:** flash\
**Created:** [March 30, 2007, 11:40am UTC](https://forum.kirupa.com/t/resetting-a-timer-on-user-input/220916 "2007-03-30T11:40:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Heath](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@David\_Heath](https://forum.kirupa.com/u/David_Heath)\
**Post date:** [March 30, 2007, 11:40am UTC](https://forum.kirupa.com/t/resetting-a-timer-on-user-input/220916/1 "2007-03-30T11:40:26Z")

</div>

Hi there,

I am currently trying to create a kind of ‘screensaver’ effect in one of my Flash movies, and I have the following code which counts down from ten to zero:

```auto
displayTime = 10;
countDown = function () {
displayTime--;
if (displayTime == 0) {
    trace("Time Out")
    clearInterval(timer);
}
};
timer = setInterval(countDown, 1000);

```

The problem I am having is finding the right code to use to RESET this countdown back to ten if the user moves the mouse, clicks a button, presses a keyboard button, etc.

Does anyone have any idea about the code I should use for this?
