A very simple class that adapts the KeyboardEvents generated by some source and altering
(or blocking) the key repeat rate.
protected var _down:Dictionary
Tracks whether a key is currently being held down.
protected var _limitRate:int
protected var _source:IEventDispatcher
Our source.
public function KeyRepeatLimiter(source:IEventDispatcher, limitRate:int = 0)
Create a KeyRepeatLimiter that will be limiting key repeat events from
the specified source.
Parameters
| source:IEventDispatcher — 0 to block all key repeats, or a millisecond value specifying how often
to dispatch KEY_DOWN events while the key is being held down. The rate will be limted
by the frame rate of the enclosing SWF.
|
|
| limitRate:int (default = 0 )
|
protected function handleKeyDown(event:KeyboardEvent):void
Parameters
protected function handleKeyUp(event:KeyboardEvent):void
Parameters
protected function handleTimerEvent(event:TimerEvent):void
Parameters
public function shutdown():void
Dispose of this KeyRepeatBlocker.
Copyright © 2007-2009 Three Rings Design, Inc.