Combining Mouse.addListener and getTimer

I need to get my movie to check if the user has click anywhere on the interface (doesn’t matter were), if there’s not click after 60second, I need to send the movie back to frame1.

I know is a combination of addListener(Mouse), onMouseMove
and getTimer. but I’m not very good at action script yet to combine the three. Any code sample and tutorials are more then appreciated.

THANKS
gepo

what happens if he does click? this should basically work:

var timerID;
function stopTimer() {
  clearInterval(timerID);
}
var mouseListener = { onMouseDown: stopTimer };
Mouse.addListener(mouseListener);
function gotoFrameOne() {
  _root.gotoAndStop(1);
}
timerID = setInterval(gotoFrameOne,60000);

yes it’s working , Almost perfect
"what happens if he does click?.."
I need a way to tell timerID that if something is click to set itself back to 0 and start cheking the time again.

can you help me with that??
much thanks

gepo

i assumed thats what you want… try this:

var timerID;
function startTimer() {
  timerID = setInterval(gotoFrameOne,60000);
}
function resetTimer() {
  clearInterval(timerID);
  startTimer();
}
var mouseListener = { onMouseDown: resetTimer };
Mouse.addListener(mouseListener);
function gotoFrameOne() {
  _root.gotoAndStop(1);
}
startTimer();

thanks brainy, almost perfect again
there’s alittle glich that I can seem to fiind. It looks like sometime [COLOR=red]var timerID;[/COLOR] ;it reset istself and sometime it doesn’t.
Could you take a look at my example??
much thanks

gepo

Can’t anybody help me clean this uP???
thanks
gepo

[AS]function startTimer() {
start = getTimer()/1000;
}
_root.onEnterFrame = function() {
elapsedTime = Math.floor(getTimer()/1000-start);
(elapsedTime == 60) ? _root.gotoAndStop(1) : trace(elapsedTime);
};
var mouseListener = new Object();
mouseListener.onMouseDown = startTimer;
Mouse.addListener(mouseListener);
startTimer();[/AS]

aaahhhhhaaaaaa perfect
obrigado Claudio,
it works perfectly
gepo

De nada Gepo (welcome)
:wink: