input-devices-$10.lzx

<canvas width="100%" height="200" debug="true">
    <debug x="110" y="15"/>   
    <!-- NOTE: Even though the view below takes focus oninit,
        in some browsers you might still need to click on the
        application itself, to take the focus away from the 
        browser itself and to the Flash Player. -->
    <view width="100" height="100" bgcolor="0x333399" focusable="true" oninit="lz.Focus.setFocus(this)">    
        <handler name="oninit">
            this.keyCodes = new Array()
            this.keyCodes[65] = "A for Apple";
            this.keyCodes[76] = "L for Laszlo";
            this.keyCodes[79] = "O for Optometrist";
            this.keyCodes[83] = "S for Sammy";
            this.keyCodes[90] = "Z for Zebra";
        </handler>     
        <handler name="onkeydown" args="akeycode">
            // respond here    
            Debug.debug("Key pressed: %w", akeycode);
            if ( this.keyCodes[akeycode] != undefined ) {
            Debug.debug("%s", this.keyCodes[akeycode] );
            } else {
            Debug.debug("You pressed: %w", String.fromCharCode(akeycode));
            }
        </handler>
    </view>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2008 Laszlo Systems, Inc.  All Rights Reserved.                   *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->

Cross References