2 Replies Latest reply on May 4, 2006 10:20 AM by kypsul

    Controling nextFrame() & prevFrame()

    kypsul Level 1
      I am using this code to allow for the right and left key to jump one frame forward or backward

      var keyListener bject = new Object;

      keyListener.onKeyDown = function():Void {
      if (Key.isDown(Key.RIGHT)) {
      if (_root._currentframe < 8){
      nextFrame();
      }
      } else if (Key.isDown(Key.LEFT)){
      if (_root._currentframe > 1){
      prevFrame();
      }
      }
      };

      Key.addListener(keyListener)
      stop();

      The problem I am having is when you press the right key (Key.RIGHT) it moves to the 2nd frame. If I then press the left key (Key.LEFT) to go back a frame then press the right key again the movie jump to frame 3 skipping frame two. This continues until there are no more frames to go to and then the left and right key press toggle between the first frame and the last frame. I need to control the nextFrame() and prevFrame method so that when pressed either forward or backward it only goes to the very next frame or the previous frame. Does anyone know how to control the two methods?

      I hope this makes sense.

      Thanks,

      Kyle