# Calling to variables

**URL:** <https://forum.kirupa.com/t/calling-to-variables/202199>\
**Category:** Uncategorized\
**Created:** [September 28, 2006, 5:58pm UTC](https://forum.kirupa.com/t/calling-to-variables/202199 "2006-09-28T17:58:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![split67](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/split67/32/2089_2.png) [@split67](https://forum.kirupa.com/u/split67)\
**Post date:** [September 28, 2006, 5:58pm UTC](https://forum.kirupa.com/t/calling-to-variables/202199/1 "2006-09-28T17:58:32Z")

</div>

I have a slideshow that uses a variable to advance to the next slide after 3 seconds. I am adding control buttons to “start”, “pause”, “advance” and “go back” in the slideshow. When i pause the slideshow, it pause for 3 seconds then continues onto the next slide because the variable is still running in the background. How can i stop this variable when the pause button is clicked and re-start it when the play button is clicked? See my code below. Thanks for the help.

var myInterval = setInterval (nextSlide, 3000);

function nextSlide () {  
slideshow\_mc.play();  
}

next\_btn.onRelease = function() {  
gotoAndStop(\_currentframe+12);  
};

prev\_btn.onRelease = function() {  
gotoAndStop(\_currentframe-12);  
};

play\_btn.onRelease = function() {  
slideshow\_mc.play();  
}

pause\_btn.onRelease = function() {  
slideshow\_mc.stop();  
}
