Packagecc.cote.jmulator.emulators
Classpublic class Ipac4
InheritanceIpac4 Inheritance Emulator Inheritance flash.events.EventDispatcher

The IpacVe class defines the characteristics of the I-PAC 4 board made by Ultimarc. It extends the base Emulator class and provides various functionalities to simplify working with this keyboard emulators. Namely, 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.

Using this class is straightforward. You create an IpacVe object and then add listeners to it for the inputs you are interested in. Here is a simple example to get you started :

     
     import cc.cote.jmulator.emulators.Ipac4;
     import cc.cote.jmulator.events.Ipac4Event;
     
     var emu:Ipac4 = new Ipac4(stage);
     emu.addEventListener(Ipac4Event.INPUT_2COIN, test);
     
     function test(e:Ipac4Event):void {
         trace(e);
     }
     

Please note that this class will only work with encoders using the default (MAME) settings and not with custom programs.

Limitations

Flash Player is currently unable to detect a KEY_DOWN or KEY_UP event for the ALT key. This means that the input labeled "1SW2" (which uses the ALT key in the default MAME configuration) does not work in Flash Player. In Adobe AIR, the "1SW2" input works fine.

Also note that the 1SW4 input - which is assigned to the SHIFT key - will never be in typematic mode. This is the behaviour of the SHIFT key on most modern operating systems and has nothing to do with your board, Flash or this library.

The inputs labeled '3SW5', '3SW6', '3SW7', '3SW8', '4SW5', '4SW6', '4SW7' and '4SW8' are not mapped in the default MAME configuration. Therefore, they cannot be used with this library.

The inputs labeled '1SW4' and '3SW2' cannot be differentiated by Flash therefore they are bound together. The same goes for '1SW1' and '3SW1'.

See also

http://www.ultimarc.com
cc.cote.jmulator.emulators.Emulator
cc.cote.jmulator.events.IpacVeEvent


Public Properties
 PropertyDefined By
 InheritedboardEventClass : Class
[read-only] The class of the currently-used emulator device.
Emulator
 InheritedcapsLock : Boolean
[read-only] Indicates if the capsLock key is currently engaged (true) or not (false).
Emulator
 InheritedjsonLabelMap : String
[read-only] A JSON representation of the board label to keyboard key mappings (useful for debugging).
Emulator
 InheritedlistenOn : InteractiveObject
[read-only] The object the emulator is listening on for key events.
Emulator
 Inheritedmap : Dictionary
[read-only] A list of the mappings between key codes (as sent by the board) and event names.
Emulator
 InheritednumLock : Boolean
[read-only] Indicates if the numLock key is currently engaged (true) or not (false).
Emulator
 InheritedsupportedBoards : Vector.<Class>
[read-only] List of emulator boards supported by this library.
Emulator
 Inheritedtriggering : String = both
The type of events that should be triggered by the Emulator object.
Emulator
 Inheritedtypematic : Boolean = false
A boolean specifying whether or not to ignore the OS typematic feature.
Emulator
Public Methods
 MethodDefined By
  
Ipac4(listenOn:InteractiveObject, typematic:Boolean = false, triggering:String)
Creates an Ipac4 object extending the base Emulator object.
Ipac4
 Inherited
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
 Inherited
dispose():void
Properly disposes of ressources used by the object, namely, the listeners.
Emulator
 Inherited
isActive(input:String):Boolean
Returns the current status (activated or not) of a specific board input.
Emulator
Constructor Detail
Ipac4()Constructor
public function Ipac4(listenOn:InteractiveObject, typematic:Boolean = false, triggering:String)

Creates an Ipac4 object extending the base Emulator object. On top of inherited properties, this object defines the board-specific mappings between input label and key code generated.

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
 
triggering:String (default = NaN) — The method to use to trigger events. Can be EmulatorTriggerMode.TRIGGER_ON, EmulatorTriggerMode.TRIGGER_OFF or EmulatorTriggerMode.TRIGGER_BOTH (default). TRIGGER_ON means to dispatch the events only when the input is activated, TRIGGER_OFF means to dispatch the events only when the input is deactivated and TRIGGER_BOTH means to trigger events when the input is activated and deactivated.