Class com.wiicade.KeyboardController

Description

The keyboard controller class is an emulation layer responsible for mapping keyboard presses to Wii Remote button presses. This functionality is only active when the Flash movie is run on a desktop computer. The functions contained in this class have no effect when run on the Nintendo Wii.

The default keyboard mappings are listed in the table below. These may be changed by calling the setKeyMapping() function. Standard Flash key codes should be used when remapping keys to Wii Remote buttons.

Key Mappings:

Wii RemoteKeyboard
Directional PadArrow Keys
1A
2S
AD
BSpace Bar
+=/+
--/_

Method Index

getButtonMappingForKey(), getKeyMappingForButton(), setKeyMapping()

Method Detail

getButtonMappingForKey

static public function getButtonMappingForKey(keyCode:Number):Number

Returns the Wii Remote Button mapped to the passed keyboard key. If no button is defined for that key, undefined is returned. Keyboard keys are represented by the same numerical codes used by the Flash Key object. Wii Remote buttons are represented by the BUTTON_<name> constants on the WiiRemote class.

Parameters

keyCodeThe key code to find the mapping for.

Return

The BUTTON value mapped to the key code.

getKeyMappingForButton

static public function getKeyMappingForButton(buttonCode:Number):Number

Returns the keyboard key mapped to a given Wii Remote button. Keyboard keys are represented by the same numerical codes used by the Flash Key object. Wii Remote buttons are represented by the BUTTON_<name> constants on the WiiRemote class.

Parameters

buttonCodeOne of the WiiRemote.BUTTON_<name> constants.

Return

The key code mapped to the Wii Remote button.

setKeyMapping

static public function setKeyMapping(buttonCode:Number, keyCode:Number):Void

Sets a new keyboard key mapping for a given Wii Remote button. If the key is already in use, its existing mapping will be deleted and replaced with the new mapping. Be careful when reassigning mappings, as this could leave some Wii Remote buttons unmapped. Keyboard keys are represented by the same numerical codes used by the Flash Key object. Wii Remote buttons are represented by the BUTTON_<name> constants on the WiiRemote class.

See the Keyboard Keys and Key Code Values page of the Learning ActionScript 2.0 in Flash online help document for more information. The Flash online help can be viewed by pressing the F1 key in the Flash Integrated Development Environment.

Parameters

buttonCodeOne of the WiiRemote.BUTTON_<name> constants.
keyCodeA key code to map to the Wii Remote button