Jmulator

The Jmulator ActionScript 3 helper library has been created to facilitate the usage of keyboard emulators (also called keyboard encoders) in ActionScript. While I mostly use it in physical computing setups, I’m sure it could be used in various other environments.

So far, only three board models can be used with the library :

  • Ultimarc I-PAC VE
  • Ultimarc I-PAC (untested)
  • Ultimarc I-PAC 4 (untested)

As you can guess, I only have an Ultimarc I-PAC VE to perform tests with. If you own one of the two untested models, let me know if Jmulator works properly with your setup. If you are a board maker and would like to have your board supported please get in touch.

What are the advantages of using this library ?

Obviously, you could easily use a keyboard encoder in the Flash and AIR runtimes without this library. The advantages offered by the library are as follows :

  • All keyboard codes dispatched by the board have already been researched for you. To use the library you simply create an object matching your board and listen for an event matching the label printed on the board itself.
  • It allows you to easily enable or disable the OS typematic feature. Typematic mode is when the OS repeatedly sends key down events when a key is being held down.
  • It allows you to easily listen to only on events, only off events or both on and off events.
  • It allows you to listen to one specific input by using the input’s name or to all inputs at once.

How do I use it ?

Jmulator is very easy to use. Here is a basic example to get you started fast :

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

All you have to do to use this code is place the folder named cc next to the .fla file in which you want to use it. The cc folder can be found under the library folder of the downloadable package (see below).

Alternatively, you can link your project to the Jmulator.swc that is available in the bin directory of the downloadable package.

The full API documentation can be viewed online and is also included in the download package.

Download it

Here is the full download package containing the Jmulator library (version 2.0b), examples, full API documentation and changelog. For those interested, the project is also available on GitHub.

Leave a Reply

Your email address will not be published. Required fields are marked *