Packagecc.cote.jmulator.emulators
Classpublic class Emulator
InheritanceEmulator Inheritance flash.events.EventDispatcher
Subclasses Ipac2, Ipac4, IpacVe

The Emulator class is an abstract class which is used, and extended, by the board-specific classes in the emulators package. The Emulator class cannot be instantiated directly. Instead, use the board-specific class matching the device you wish to use.

See also

cc.cote.jmulator.emulators
flash.events.EventDispatcher
http://cote.cc/projects/jmulator


Public Properties
 PropertyDefined By
  boardEventClass : Class
[read-only] The class of the currently-used emulator device.
Emulator
  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
  listenOn : InteractiveObject
[read-only] The object the emulator is listening on for key events.
Emulator
  map : Dictionary
[read-only] A list of 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
  supportedBoards : Vector.<Class>
[read-only] List of emulator boards supported by this library.
Emulator
  triggering : String = both
The type of events that should be triggered by the Emulator object.
Emulator
  typematic : Boolean = false
A boolean specifying whether or not to ignore the OS typematic feature.
Emulator
Public Methods
 MethodDefined By
  
Emulator(listenOn:InteractiveObject, typematic:Boolean = false, triggering:String)
Constructor (private).
Emulator
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
[override] Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
Emulator
  
dispose():void
Properly disposes of ressources used by the object, namely, the listeners.
Emulator
  
isActive(input:String):Boolean
Returns the current status (activated or not) of a specific board input.
Emulator
Property Detail
boardEventClassproperty
boardEventClass:Class  [read-only]

The class of the currently-used emulator device.


Implementation
    public function get boardEventClass():Class
capsLockproperty 
capsLock:Boolean  [read-only]

Indicates if the capsLock key is currently engaged (true) or not (false).


Implementation
    public function get capsLock():Boolean
jsonLabelMapproperty 
jsonLabelMap:String  [read-only]

A JSON representation of the board label to keyboard key mappings (useful for debugging).


Implementation
    public function get jsonLabelMap():String
listenOnproperty 
listenOn:InteractiveObject  [read-only]

The object the emulator is listening on for key events. This is typically the stage.


Implementation
    public function get listenOn():InteractiveObject
mapproperty 
map:Dictionary  [read-only]

A list of the mappings between key codes (as sent by the board) and event names.


Implementation
    public function get map():Dictionary
numLockproperty 
numLock:Boolean  [read-only]

Indicates if the numLock key is currently engaged (true) or not (false).


Implementation
    public function get numLock():Boolean
supportedBoardsproperty 
supportedBoards:Vector.<Class>  [read-only]

List of emulator boards supported by this library.


Implementation
    public function get supportedBoards():Vector.<Class>
triggeringproperty 
public var triggering:String = both

The type of events that should be triggered by the Emulator object. It can be set to trigger events when inputs are activated only (EmulatorTriggerMode.TRIGGER_ON), when they are deactivated only (EmulatorTriggerMode.TRIGGER_OFF) or on both activation and deactivation (EmulatorTriggerModeTRIGGER_BOTH).

The default value is EmulatorTriggerMode.TRIGGER_BOTH.

typematicproperty 
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 events will be triggered if the input stays activated for a while.

The default value is false.

Constructor Detail
Emulator()Constructor
public function Emulator(listenOn:InteractiveObject, typematic:Boolean = false, triggering:String)

Constructor (private). Cannot be instantiated directly. Use a board-specific class instead.

Parameters
listenOn:InteractiveObject — An InteractiveObject to attach the keyboard listener to. Usually this is the Stage.
 
typematic:Boolean (default = false) — 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 = NaN) — Triggering method : on button press only (EmulatorTriggerMode.TRIGGER_ON), on button release only (EmulatorTriggerMode.TRIGGER_OFF) or on both press and release (EmulatorTriggerMode.TRIGGER_BOTH).

Throws
Error — The Emulator class cannot be instantiated directly. Use a subclass from the emulators package.
Method Detail
addEventListener()method
override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.

Parameters

type:String — The type of event
 
listener:Function — The listener function that processes the event. This function must accept an Event object as its only parameter and must return nothing.
 
useCapture:Boolean (default = false) — Determines whether the listener works in the capture phase or the target and bubbling phases.
 
priority:int (default = 0) — The priority level of the event listener. The priority is designated by a signed 32-bit integer. The higher the number, the higher the priority.
 
useWeakReference:Boolean (default = false) — Determines whether the reference to the listener is strong or weak. A strong reference (the default) prevents your listener from being garbage-collected.


Throws
ArgumentError — The requested input is disabled in the current configuration.
dispose()method 
public function dispose():void

Properly disposes of ressources used by the object, namely, the listeners.

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

Returns
Boolean — A boolean indicating if the input is in active mode (true) or inactive mode (false).