# Another Newbie in need of help

**URL:** <https://forum.kirupa.com/t/another-newbie-in-need-of-help/199534>\
**Category:** flash\
**Created:** [September 3, 2006, 7:58pm UTC](https://forum.kirupa.com/t/another-newbie-in-need-of-help/199534 "2006-09-03T19:58:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jproehl](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jproehl](https://forum.kirupa.com/u/jproehl)\
**Post date:** [September 3, 2006, 7:58pm UTC](https://forum.kirupa.com/t/another-newbie-in-need-of-help/199534/1 "2006-09-03T19:58:51Z")

</div>

Hi all:

I’m trying to develop a Flash 8 package for use in a Children’s Science museum. It  
will be a dedicated code viewed by Flash Player through Firefox. What I’m having  
trouble with is trying to implement setTimeout so that the code will revert to the  
first page after a defined time period. The timeout I seem to be able to set, but what  
I want to do is have the timeout get reset if there is a mouse click. I’ve tried several  
naive things, the last being defining a mouse listener on the root page (frame #1):

======================================  
stop();  
var mouseListener:Object;  
mouseListener=new Object();  
mouseListener.onMouseDown = function() {  
if(timer1 != null) {  
clearTimeout(timer1);  
}  
var timer1=setTimeout(restart,15\*1000);  
};  
Mouse.addListener(mouseListener);

# function restart() { \_root.gotoAndStop(1); }

What I’m getting is the timer never seems to get reset when I click the mouse.  
In fact the time interval gets shorter as if many timers are being set. What am  
I missing? I tried commenting out the if test and just letting the clearTimeout get  
called each time, this didn;t change anything. I really am new at Flash, so don’t  
assume I know all the syntax or tricks of the trade.

Also, if there is a better way to do this please let me know.

In case its important, the structure of my Flash code is “Page 1” is a loop animation  
that the user can click anywhere. This click moves to “Page2” that gives a descripition  
of what the thing is all about, there is a button on this to go to “Page 3”. Page 3 has  
a map and 6 buttons that link to 6 differect animations. On each animation the user  
can pause, rewind, play or go back to page 3. As long as they are clicking the mouse,  
I want the code to let them navigate around, once the mouse goes without a click for 5  
minutes I want it to go back to page 1.

Any help would be appreciated.
