# Flash 'Screensaver' using setInterval

**URL:** <https://forum.kirupa.com/t/flash-screensaver-using-setinterval/233935>\
**Category:** flash\
**Created:** [July 28, 2007, 11:53am UTC](https://forum.kirupa.com/t/flash-screensaver-using-setinterval/233935 "2007-07-28T11:53:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kt\_sc](https://avatars.discourse-cdn.com/v4/letter/k/85e7bf/32.png) [@kt\_sc](https://forum.kirupa.com/u/kt_sc)\
**Post date:** [July 28, 2007, 11:53am UTC](https://forum.kirupa.com/t/flash-screensaver-using-setinterval/233935/1 "2007-07-28T11:53:29Z")

</div>

After detecting that the user is idle for more than the wait time, the ‘areyoustillthere.swf’ movie is played. Which works fine.

But as this movie is played, i want to confirm if the user is really not there. So i need to detect his mousePos again. How do i do that?

```auto
var numWaitTime:Number = 2*1000; // Time in seconds to wait, before switching back to main screen

startTracking();

function startTracking() {
	mousePos = -100000;
	trackMove = setInterval(detectIdle, 2000);
}

function detectIdle() {
	if ((_root._xmouse+_root._ymouse) != mousePos) {
		clearInterval(idle);
		idle = setInterval(idleTime, numWaitTime);
	}    
	mousePos = _root._xmouse+_root._ymouse;
}
function idleTime() {
	_root.createEmptyMovieClip("mc1", this.getNextHighestDepth());
	mc1.loadMovie("data/areyoustillthere.swf");
	trace("are you still there?");
	
	mc1._x = 250;
	mc1._y = 125;
	new Tween(mcAsk, "_alpha", Regular.easeIn, 25, 100, 1, true);
	mousePos = _root._xmouse+_root._ymouse;
}
function startTracking() {
	trace("bring user back to home");
}

```
