3

AS3 can catch keyboard events, but how catch usb joystick's input event ?

2smacks
  • 168
  • 2
  • 9
  • aren't USB game controllers just mapped to keyboard keys? – Chunky Chunk Feb 05 '12 at 18:48
  • Yes I think, but with a keyboard event, flashdevelop trace anything else than keyboard's input. – 2smacks Feb 05 '12 at 18:51
  • @2smacks can you show the output you get when you trace the keyboard events you get from your usb game controller input, I didn't understand your last comment. – Taurayi Feb 05 '12 at 19:18

1 Answers1

6

There are some new packages for this.

http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/ui/GameInput.html

I haven't gotten around to this yet, but it seems very similar to the keyboard input.

Basically, you have to:

  1. Detect the USB controller in flash.
  2. Determine what type of inputs the device has (wheel, joystick, touchpad, etc.).
  3. Decode the signals from the USB device and create a sort of key-map for your controller.
  4. Use the key-map you created in much the same way as keyboard input, but using GameInputEvent listeners instead of KeyboardEvents.
okayGraphics
  • 375
  • 2
  • 10