Calling to variables

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();
}