1 Reply Latest reply on Jul 12, 2010 4:49 AM by Ned Murphy

    How to set Keyboard control

    toastiesmonster

      is the following scripts correct to stop animation by pressing  "Space Bar" if the animation is playing. And to play the animation again  if the animation is paused. Is there any additional criteria need to be added to make it more solid. Thanks.

       

      keyListener = new Object();
      var isStopped : Boolean = false;

      keyListener.onKeyDown = function() {
         var keyCode = Key.getCode();
        
         if (keyCode == 13) {
            _root.play();
              }
      if (keyCode == 32) {
            _root.stop();
              }
      };
      Key.addListener(keyListener);