Skip to main content
Participant
June 5, 2006
Question

Navigating after inactivity

  • June 5, 2006
  • 1 reply
  • 177 views
Hi,

Inside my flash presentation I want to go to a pre-defined Scene/Frame after a period of user inactivity (i.e. no keyboard inputs or mouse movements). In other words it will act as a form of screensaver whereby if the user is not using the presentation it will show something pretty.
I am using Flash MX 2004.
Any ideas?
Ross
This topic has been closed for replies.

1 reply

Inspiring
June 5, 2006
Hi,

this is adapted from another thread (search the forum for 'activity', it's the 2nd that comes up):
--
if (!timeoutID) {
var timeoutID = setInterval(timedOut, 10000);
}
function timedOut() {
clearInterval(timeoutID);
trace("timeout");
}
var myListener bject = new Object();
myListener.onKeyDown = myListener.onMouseMove = function () {
clearInterval(timeoutID);
timeoutID = setInterval(timedOut, 10000);
};
Key.addListener(myListener);
Mouse.addListener(myListener);
--
Place this code in frame 1 of your movie, and you're done. In the function 'timedOut', change the trace("timeout") line to the code you want to have executed, e.g. gotoAndPlay("screensaver").

greets,
blemmo