AS3 can catch keyboard events, but how catch usb joystick's input event ?
Asked
Active
Viewed 6,526 times
3
-
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 Answers
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:
- Detect the USB controller in flash.
- Determine what type of inputs the device has (wheel, joystick, touchpad, etc.).
- Decode the signals from the USB device and create a sort of key-map for your controller.
- 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
-
-
`flash.ui.GameInput` doesn't work at all. Any call to properties throws **not defined** error. It seems to be only available in AIR bs. – n4pgamer Mar 24 '14 at 16:21