To accomplish this you need 2 things, 1. Knowing when interaction happened in the flash movie. 2. Check if time elapsed since the last interaction is greater than threshold. Here’s some sample code.
IDLE_MS = 2*60*1000;// 2 minutes
function onTick () {
if (getTimer () - this._iLastInteract > IDLE_MS) {
this.onIdle ();
};
};
function start () {
Mouse.addListener (this);
Key.addListener (this);
this._iTickId = setInterval (this, "onTick", 1000);
this.onInteract ();
};
function onInteract () {
this._iLastInteract = getTimer ();
// you will need to have some code here to come out of the screensaver mode.
};
function onIdle () {
// add idle code here to perform the screensaver switch.
};
function onKeyDown () {
this.onInteract ();
};
function onMouseDown () {
this.onInteract ();
};
start ();
You might want to add additional event handlers like for mouse move, to take this further.