Looping Slide Presentation

Hello,

I am working on a slide presentation that automatically advances to the next slide or moves to the next or previous slide via navigation buttons.

This part I have finished.

I am having trouble getting the presentation to loop after the last slide. I have been able make it loop once the next button is pressed on the last slide but I cannot get it to advance to the first slide automatically.

Below is the code that I am using in the presentation (master) slide:

on (load) {
setInterval(function () {
_root.presentation.currentSlide.gotoNextSlide();
}, 6000);

}

And the code for the next button:

on (release) {

	  // GoTo Next Screen behavior
      var screen = null;
      var target = this;
      while((screen == null) && (target != undefined) && (target != null))
      {
        if(target instanceof mx.screens.Screen)
        {
          screen = target;
        }
        else
        {
          target = target._parent;
        }
      }
      if(screen instanceof mx.screens.Slide)
      {
		screen.rootSlide.gotoFirstSlide();
      }
	  // End GoTo Next Screen behavior
    
}

Any help with this is appreciated.