1 Reply Latest reply on Sep 16, 2013 12:27 PM by AMULI
      • 1. Re: Keypress/keyCode plays animation
        AMULI Level 4

        Hi RavenDesign,

         

        In fact, your event handler was only that (correctly indenting helps you detect incorrectly parenthized code) :

         

        $(window).keydown(function(e) {

          if(e.keyCode == 37) { /// left btn

            sym.play('FirstAnimation');

            });

         

        Use document and switch :

         

        $(document).keydown(function(e)

        {

          switch( e.keyCode)

          {

            case 37: // left

              sym.play('FirstAnimation');

              break;

            case 39: // right

              sym.play('SecondAnimation');

              break;

          }

        });

         

        Gil