     /** Tracks whether a key is currently being held down. */
     protected var _down :Dictionary = new Dictionary();
 
-    /** How many keys are currently down? */
-    protected var _keysDown :int;
-
-    /** The timer generating key repeats, if any. */
-    protected var _timer :Timer;
+    protected var _limitRate :int;
 }
 }

import flash.utils.Dictionary;
import flash.utils.Timer;

/**
 * A very simple class that adapts the KeyboardEvents generated by some source and altering
 * (or blocking) the key repeat rate.

        _source.removeEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);
        _source.removeEventListener(KeyboardEvent.KEY_UP, handleKeyUp);

        // shut down any timers
        for each (var val :* in _down) {
            if (val is Array) {
                ((val as Array)[0] as Timer).stop();
            }
        }
        _down = new Dictionary();
    }

    protected function handleKeyDown (event :KeyboardEvent) :void
    {
        var oldVal :* = _down[event.keyCode];
        if (oldVal === undefined) {
            _down[event.keyCode] = (_limitRate > 0) ? getTimer() : 0;

        } else if ((oldVal is Number) && _limitRate > 0) {
            var timeUntilRepeat :Number = _limitRate - (getTimer() - Number(oldVal));

            var t :Timer = new Timer((timeUntilRepeat <= 0) ? _limitRate : timeUntilRepeat);
            t.addEventListener(TimerEvent.TIMER, handleTimerEvent);
            _down[event.keyCode] = [ t, event ];
            t.start();
            if (timeUntilRepeat > 0) {
                // don't dispatch this event, wait for our first repeat time
                return;
            }

        } else {
            // eat the event
            return;
        }

        // otherwise, dispatch the event
        dispatchEvent(event);
    }

    protected function handleKeyUp (event :KeyboardEvent) :void
    {
        var oldVal :* = _down[event.keyCode];
        if (oldVal !== undefined) {
            if (oldVal is Array) {
                ((oldVal as Array)[0] as Timer).stop();
            }
            delete _down[event.keyCode];
        }

        // always dispatch an up
