# Screen Saver

**URL:** <https://forum.kirupa.com/t/screen-saver/30116>\
**Category:** flash\
**Created:** [September 4, 2003, 2:44am UTC](https://forum.kirupa.com/t/screen-saver/30116 "2003-09-04T02:44:15Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![HelloKittyGurl](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@HelloKittyGurl](https://forum.kirupa.com/u/HelloKittyGurl)\
**Post date:** [September 4, 2003, 2:44am UTC](https://forum.kirupa.com/t/screen-saver/30116/1 "2003-09-04T02:44:15Z")

</div>

Hello Peoples!!  
What I wanted to do was make like a flash presentation that a person could use but if the mouse was left alone for a while then it would load another flash movie presentation. Kind of like a screen saver. Does anyone know how I can achive this?:thumb:  
I was thinking about 1 minute rest time before the other movie will load. Am I asking too much or can anyone help me? Or direct me to a tutorial on this?

Thanks,  
Roxy Gurl:bu:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 4, 2003, 2:55am UTC](https://forum.kirupa.com/t/screen-saver/30116/2 "2003-09-04T02:55:24Z")

</div>

Should be simple.

Have a little thing that starts a timer when the mouse stops moving. When the timer reaches a value, go to a frame or scene with your ‘screensaver’ stuff.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 4, 2003, 3:09am UTC](https://forum.kirupa.com/t/screen-saver/30116/3 "2003-09-04T03:09:10Z")

</div>

Lets say your screensaver mc is on frame 10:[AS]mouseListener = new Object();  
mySeconds = 2;//how many seconds of inactivity  
function startTimer() {  
initial = getTimer()/1000;  
}  
function screenSaver() {  
this.onEnterFrame = null;  
this.gotoAndStop(10);  
}  
this.onEnterFrame = function() {  
elapsedTime = Math.floor(getTimer()/1000-initial);  
(elapsedTime == mySeconds) ? screenSaver() : trace(elapsedTime);  
};  
mouseListener.onMouseMove = startTimer;  
Mouse.addListener(mouseListener);  
startTimer();[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 4, 2003, 3:10am UTC](https://forum.kirupa.com/t/screen-saver/30116/4 "2003-09-04T03:10:21Z")

</div>

Hehe, yup, there it is, nice claudio.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 4, 2003, 3:16am UTC](https://forum.kirupa.com/t/screen-saver/30116/5 "2003-09-04T03:16:42Z")

</div>

Thanks :beam:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 4, 2003, 11:42pm UTC](https://forum.kirupa.com/t/screen-saver/30116/6 "2003-09-04T23:42:29Z")

</div>

Thanks a lot youse guys. It works fine!! By any chance can I use this code for the mouse movement to end the movie that was just loaded. If you can help me that is fine but this was more important which you heros have just helped me with.

-RoxyGurl

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 5, 2003, 1:04am UTC](https://forum.kirupa.com/t/screen-saver/30116/7 "2003-09-05T01:04:12Z")

</div>

Welcome 🙂  
Hmm i dont quite get what you want … :-  
Can you explain it for me?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 5, 2003, 4:57am UTC](https://forum.kirupa.com/t/screen-saver/30116/8 "2003-09-05T04:57:36Z")

</div>

I think she wants the “screensaver” to quit and go back to where the user was before it was loaded

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 5, 2003, 5:35am UTC](https://forum.kirupa.com/t/screen-saver/30116/9 "2003-09-05T05:35:44Z")

</div>

Ok HelloKittyGurl. Make your screensaver a movie clip and give it an instance name of _screensaver\_mc_. Put it in a layer and its important it covers the entire timeline and it should be on top of any other layer. Now apply the following code on the first frame of your main timeline:[AS]this.screensaver\_mc.\_visible = false;  
mouseListener = new Object();  
mySeconds = 2;//how many seconds of inactivity  
function startTimer() {  
initial = getTimer()/1000;  
iniTime = (initial-pauseTime)+iniTime;  
this.play();  
this.screensaver\_mc.\_visible = false;  
playing = true;  
}  
function screenSaver() {  
pauseTime = getTimer()/1000;  
this.stop();  
this.screensaver\_mc.\_visible = true;  
playing = false;  
}  
\_root.onEnterFrame = function() {  
elapsedTime = getTimer()/1000-iniTime;  
if (playing) {  
elapsedTime = Math.floor(getTimer()/1000-initial);  
(elapsedTime == mySeconds) ? screenSaver() : trace(elapsedTime);  
}  
};  
mouseListener.onMouseMove = function() {  
\_root.startTimer();  
};  
Mouse.addListener(mouseListener);[/AS]This will call the screensaver\_mc after 2 seconds of inactivity.  
[edit]While the screensaver is being displayed, the main movie stops. If the user moves the mouse, the main movie continues playing.[/edit]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 28, 2003, 2:07am UTC](https://forum.kirupa.com/t/screen-saver/30116/10 "2003-10-28T02:07:37Z")

</div>

Thanks again! I was using it for a presentation that was going to be in a booth. I put the web page that I made for the company on a cd but if no one was using the web page I wanted another mc to start kinda showcasing the web page more of a presentation style. Since both were made in flash I got to use your code and it worked perfectly. The booth was a success!!  
The booth was for a surf store in Hawaii. Thanks again,  
RoxyGurl  
:love:
