# setInterval pause suspension?

**URL:** <https://forum.kirupa.com/t/setinterval-pause-suspension/251157>\
**Category:** flash\
**Created:** [February 5, 2008, 9:18pm UTC](https://forum.kirupa.com/t/setinterval-pause-suspension/251157 "2008-02-05T21:18:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adra](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@Adra](https://forum.kirupa.com/u/Adra)\
**Post date:** [February 5, 2008, 9:18pm UTC](https://forum.kirupa.com/t/setinterval-pause-suspension/251157/1 "2008-02-05T21:18:04Z")

</div>

I’m making a slide show in flash (currently MX, but I may be upgrading within the month).

It’s fairly simple at the moment - just using motion tweens to fade between the pictures.

On the main movie, I only have the first frame, which holds two layers (Images, and Navigation)

On the images layer, I have a movieclip which contains the slideshow.

Instead of adding a bunch of frames to ‘pause’ over an image, I used the setInterval command, which calls a pause funcion (will show code later), since this seems an easier way to navigate backwards and forwards.

**My problem is that when I hit pause when the image frame is fully loaded (therefore the setInterval command is beginning to go into effect), it will not pause.**

I’ve tried a few different ways; none of which seem to work. I decided to go back to my most basic code, since the others didn’t work either. This is my current code:

**pause function:**

function pause(){  
if (pausetoggle != true){  
play();  
clearInterval(timer);  
}}

**On pausing frames:**

stop();  
timer = setInterval(pause, 1000);

**Pause button:**

on (release) {  
mov\_images1.stop();  
clearInterval(timer);  
pausetoggle = true;  
}

**Play button:**

on (release) {  
var pausetoggle = false;  
mov\_images1.play();  
}

It seems as though this should work –  
I have tried 1 and 0 instead of true and false, other if statements in the pause function, and a few other roundabout ways. If anyone could help me figure out this problem, I would really appreciate it. It’s probably something stupid - that is almost always my problem when doing code.

Thanks you for your time! =)
