title: going to next or previous frame in javascript
body: <p>So I am a bit new to javascript and I am looking to create a switch statement for keyboard functions relating to my animation. So if I were to click backspace it stops the animation, and when I click enter it resumes etc. That works but im also trying to get it to advance to the next frame or the previous frame when i click the left or right key, and it isn't entirely working. Sorry this is my first post but any suggestions or help would be great! </p>
  
  <pre><code>var roote = this;
  
  addEventListener("keydown", controlBox);
  
  function controlBox(evt){
  
  switch(evt.keyCode){
  case 8:
  roote.box.stop();
  break;
  case 13:
  roote.box.play();
  break;
  
  //previous frame
  case 37:
  roote.box.prevFrame();
  break;
  //next frame
  case 39:
  roote.box.nextFrame();
  break;
  }
  }
  
  var theFrame = document.getElementsByTagName("frame")[0];
  var frameNumb = parseInt(theFrame, 10);
  
  
  
  function prevFrame(){
  roote.gotoAndStop((frameNumb) -1);
  }
  
  function nextFrame(){
  
  roote.gotoAndStop((frameNumb) +1);
  }
  </code></pre>