title: Flash slide show with timer object and the option to go forward or backwards
body: <p>I am new to using Flash, but with some helpful YouTube tutorials and various Google searches, I was able to create a slide show that automatically transitions to the next after 6 seconds. I also thought it would be neat if I could give users the ability to go back or forward or jump specifically to a certain slide. But my problem is that after I click a button, the timer seems to be off.</p>
  
  <p>Here is my actionscript code:</p>
  
  <pre><code>import flash.events.MouseEvent;
  import flash.utils.*;
  
  // Stop initial picture fading from looping
  stop()
  
  // New timer object set to 6 seconds (1000 milliseconds/second)
  var myTimer:Timer = new Timer(6000, 1);
  
  myTimer.addEventListener ("timer", timerHandler);
  myTimer.reset();
  myTimer.start();
  
  function timerHandler(event:TimerEvent): void {
  if(currentFrame == 4){
       myTimer.reset();
       myTimer.start();
       gotoAndStop("pajNtaub");
   }else{
       myTimer.reset();
       myTimer.start();
       nextFrame();
       }
  }
  
  // Move to next state
  function onNextClick(event:MouseEvent):void{
      if(currentFrame == 4){
          myTimer.reset();
          myTimer.start();
          gotoAndStop("pajNtaub");
      }else{
          myTimer.reset();
          myTimer.start();
          nextFrame();
      }
  }
  forwardArrow.addEventListener(MouseEvent.CLICK, onNextClick);
  
  // Move to previous state
  function onPrevClick(event:MouseEvent):void{
      if(currentFrame == 1){
          myTimer.reset();
          myTimer.start();
          gotoAndStop("posHuab");
      }else{
          myTimer.reset();
          myTimer.start();
          prevFrame();
      }
  }
  backArrow.addEventListener(MouseEvent.CLICK, onPrevClick);
  
  // First button
  function play0(event:MouseEvent):void{
      myTimer.reset();
      myTimer.start();
      gotoAndStop("pajNtaub");
  }
  button0.addEventListener(MouseEvent.CLICK,play0);
  
  // Second button
  function play1(event:MouseEvent):void{
      myTimer.reset();
      myTimer.start();
      gotoAndStop("kabTab");
  }
  button1.addEventListener(MouseEvent.CLICK,play1);
  
  // Third button
  function play2(event:MouseEvent):void{
      myTimer.reset();
      myTimer.start();
      gotoAndStop("nroog");
  }
  button2.addEventListener(MouseEvent.CLICK,play2);
  
  // Fourth button
  function play3(event:MouseEvent):void{
      myTimer.reset();
      myTimer.start();
      gotoAndStop("posHuab");
  }
  button3.addEventListener(MouseEvent.CLICK,play3);
  </code></pre>