Search code examples
javascripthtmllimejs

How to handle keyboard events in LimeJS javascript for html5


I am a beginner in limeJS i want to know how to handle keyboard events in a game using limejs for html5.If one have a source link for it please help me.


Solution

  • Since Lime is built on Closure, you can just use its native event library.

    For example:

    goog.events.listen(rootLimeNodeObject, goog.events.EventType.KEYUP, function (ev) {
      if (ev.keyCode === 37) { // left arrow
        ...
      }
    });