Director

Keyboard Events

The director object can receive keyboard events. In fact, it is not a director object's property, but a CAAT environment property.

Simply by calling:

                        /**
                         * @param key {number} key code
                         * @param action {up|down}
                         * @param modifiers {object} is as object with the structure
                         *   {
                         *     alt:     {boolean},
                         *     control: { boolean },
                         *     shift:   { boolean }
                         *   }
                         * @param originalKeyEvent {object} the original key event. Suitable for calling
                         *  preventdefault.
                         */
                        CAAT.registerKeyListener( function(key,action,modifiers,originalKeyEvent) {
                                if ( key==68 && action=='up') {
                                    director.debug= !director.debug;
                                }
                            });
                    
the parameter function will be notified upon action='up' or action='down' for each key press event.