Package | cc.cote.jmulator |
Class | public class Emulator |
Inheritance | Emulator ![]() |
Subclasses | Ipac2, Ipac4, IpacVe |
emulators
sub-package. It provides
various functionalities to simplify the process of working with keyboard
emulators (also called encoders). By using one of its subclasses, you
will be freed from researching keyboard codes. You will be able to simply
listen to events bearing the same names as the labels on the board you
use. The class also offers additional functionalities such as selective
typematic management and the choice between receiving all events, only ON
events or only OFF events.
See also
Property | Defined By | ||
---|---|---|---|
capsLock : Boolean [read-only]
Indicates if the capsLock key is currently engaged (true) or not
(false)
| Emulator | ||
jsonLabelMap : String [read-only]
A JSON representation of the board label to keyboard key mappings
(useful for debugging)
| Emulator | ||
map : Dictionary
A Dictionary object that specifies the mappings between key codes (as
sent by the board) and event names
| Emulator | ||
numLock : Boolean [read-only]
Indicates if the numLock key is currently engaged (true) or not
(false)
| Emulator | ||
triggering : String = both
A string that identifies which type of events should be triggered by
the Emulator object. | Emulator | ||
typematic : Boolean = false
A boolean specifying whether or not to ignore the OS typematic
feature. | Emulator |
Method | Defined By | ||
---|---|---|---|
Emulator(listenOn:InteractiveObject, typematic:Boolean = true, triggering:String = both)
The Emulator class simplifies interfacing with a variety of keyboard
emulators/encoders
| Emulator | ||
isActive(input:String):Boolean
Returns the current status (activated or not) of a specific board
input
| Emulator |
Constant | Defined By | ||
---|---|---|---|
INPUT_ANY : String = any [static]
Constant associated with any input. | Emulator | ||
TRIGGER_BOTH : String = both [static]
A string constant to specify that both "on" and "off" states should
be triggering the dispatch of events
| Emulator | ||
TRIGGER_OFF : String = off [static]
A string constant to specify that only "off" states should be
triggering the dispatch of events
| Emulator | ||
TRIGGER_ON : String = on [static]
A string constant to specify that only "on" states should be
triggering the dispatch of events
| Emulator |
capsLock | property |
capsLock:Boolean
[read-only] Indicates if the capsLock key is currently engaged (true) or not (false)
public function get capsLock():Boolean
jsonLabelMap | property |
jsonLabelMap:String
[read-only] A JSON representation of the board label to keyboard key mappings (useful for debugging)
public function get jsonLabelMap():String
map | property |
public var map:Dictionary
A Dictionary object that specifies the mappings between key codes (as sent by the board) and event names
numLock | property |
numLock:Boolean
[read-only] Indicates if the numLock key is currently engaged (true) or not (false)
public function get numLock():Boolean
triggering | property |
public var triggering:String = both
A string that identifies which type of events should be triggered by the Emulator object. It can be set to trigger events when inputs are activated only, when they are deactivated only or on both activation and deactivation (TRIGGER_ON, TRIGGER_OFF or TRIGGER_BOTH).
The default value is TRIGGER_BOTH
.
typematic | property |
public var typematic:Boolean = false
A boolean specifying whether or not to ignore the OS typematic feature. If typematic is enabled (it usually is), a stream of identical characters is generated when the user holds down a key for a period of time.
The default value is false
.
Emulator | () | Constructor |
public function Emulator(listenOn:InteractiveObject, typematic:Boolean = true, triggering:String = both)
The Emulator class simplifies interfacing with a variety of keyboard emulators/encoders
ParameterslistenOn:InteractiveObject — An InteractiveObject to attach the keyboard listener
to. Usually this is the Stage.
| |
typematic:Boolean (default = true ) — Whether or not to use the OS typematic feature. When
the typematic feature is enabled, the OS repeatedly sends keydown
events when a key is being held down
| |
triggering:String (default = both ) — Triggering method : on button press only (TRIGGER_ON),
on button release only (TRIGGER_OFF) or on both press and release
(TRIGGER_BOTH)
|
Error — The Emulator class cannot be instantiated directly. Use
a subclass from the emulators package
|
isActive | () | method |
public function isActive(input:String):Boolean
Returns the current status (activated or not) of a specific board input
Parameters
input:String — Board input label
|
Boolean — A boolean indicating if the input is in active mode (true) or
inactive mode (false)
|
INPUT_ANY | Constant |
public static const INPUT_ANY:String = any
Constant associated with any input. Allows listening to all inputs at once. Since static properties are not inherited, it also needs to be defined in board classes.
TRIGGER_BOTH | Constant |
public static const TRIGGER_BOTH:String = both
A string constant to specify that both "on" and "off" states should be triggering the dispatch of events
TRIGGER_OFF | Constant |
public static const TRIGGER_OFF:String = off
A string constant to specify that only "off" states should be triggering the dispatch of events
TRIGGER_ON | Constant |
public static const TRIGGER_ON:String = on
A string constant to specify that only "on" states should be triggering the dispatch of events