Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's another example using jQuery. You can see some sort of demo <a href="http://sorinvasilescu.ro/keycode/" rel="nofollow noreferrer">here</a>. It traces the keypresses from the browser to a textbox.</p> <p>Your JavaScript would be</p> <pre><code>var altPressed = false; var ctrlPressed = false; function getFlashMovie(movieName) { var isIE = navigator.appName.indexOf("Microsoft") != -1; return (isIE) ? window[movieName] : document[movieName]; } function sendCode(code) { movie = getFlashMovie('keyboard-listener'); movie.keyEvent(code); } function activeKey(e) { e.preventDefault(); if (e.which == 18) altPressed = true; if (e.which == 17) ctrlPressed = true; if ((e.which != 18)&amp;&amp;(e.which != 17)) sendCode((altPressed?'alt+':'')+(ctrlPressed?'ctrl+':'')+String.fromCharCode(e.which)); } function inactiveKey(e) { if (e.which == 18) altPressed = false; if (e.which == 17) ctrlPressed = false; } $(document).ready(function() { $(document).keydown(activeKey); $(document).keyup(inactiveKey); }); </code></pre> <p>Inside the Flash movie, you would have the following code:</p> <pre><code>ExternalInterface.addCallback('keyEvent',keyEvent); function keyEvent(code:String):void { // do something with the "code" parameter, that looks like "alt+ctrl+D", may use .split('+'), etc } </code></pre> <p>You'll need to import <a href="http://jquery.com/" rel="nofollow noreferrer">jQuery</a> in your html file and that's about it. jQuery is cross-browser, so no problems should arise. Tested on Safari, Firefox and Opera (OSX).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload