{"id":3328,"date":"2015-01-27T20:00:56","date_gmt":"2015-01-28T03:00:56","guid":{"rendered":"http:\/\/www.nathalielawhead.com\/candybox\/?p=3328"},"modified":"2016-07-30T12:08:18","modified_gmt":"2016-07-30T19:08:18","slug":"adobe-airflash-gameinput-api-getting-started","status":"publish","type":"post","link":"https:\/\/www.nathalielawhead.com\/candybox\/adobe-airflash-gameinput-api-getting-started","title":{"rendered":"Adobe AIR\/Flash GameInput API (Getting Started)"},"content":{"rendered":"<p><strong>Update (May 29, 2016):<\/strong><br \/>\nemmett butler has an even more thorough post on the topic here, <a href=\"http:\/\/emmett9001.tumblr.com\/post\/145109747628\/nativejoystick-in-bum-rush\" target=\"_blank\">NativeJoystick in Bum Rush<\/a> <\/p>\n<p>I suggest starting with that since his post is a lot more in depth.<\/p>\n<p>I had been emailed about this issue (problems with GameInput) and gave some links that I thought helpful at the time I was working with controllers. Here they are in the event they can help others:<\/p>\n<p>* <a href=\"http:\/\/2bam.com\/2014\/08\/25\/nativejoystick-air-ane-extension-to-support-all-joysticks-that-windows-can\/\" target=\"_blank\">NativeJoystick: AIR \u201cANE\u201d extension to support all joysticks that Windows can.<\/a><br \/>\n* <a href=\"https:\/\/forums.tigsource.com\/index.php?topic=42936.0\" target=\"_blank\">Topic: NativeJoystick: AIR \u201cANE\u201d extension to support all joysticks that Windows can.<\/a><br \/>\n* <a href=\"https:\/\/github.com\/StackAndHeap\/joystick-ane\" target=\"_blank\">Joystick Library for Adobe AIR<\/a><br \/>\n* <a href=\"https:\/\/github.com\/as3sdkuk\/GamePad\" target=\"_blank\">GamePad<\/a><br \/>\n* <a href=\"https:\/\/github.com\/zeh\/key-action-binder-as3\" target=\"_blank\">AS3 Controller Input<\/a><br \/>\n* <a href=\"https:\/\/github.com\/DaVikingCode\/Citrus-Engine\/tree\/master\/src\/citrus\/input\/controllers\" target=\"_blank\">Citrus-Engine\/src\/citrus\/input\/controllers\/<\/a><br \/>\n* <a href=\"http:\/\/forum.starling-framework.org\/topic\/gameinputdevice-support\" target=\"_blank\">GameInputDevice Support&#8230; <\/a><\/p>\n<p>I was also looking into sockets, or something like <a href=\"http:\/\/www.bytearray.org\/?p=1268\" target=\"_blank\">http:\/\/www.bytearray.org\/?p=1268<\/a><\/p>\n<p>It has been a while since I worked with this, and there are problems (various use cases). It still seems the best to make your own solution (ane)&#8230; but good luck. Here&#8217;s my post:<\/p>\n<p><strong>Adobe AIR\/Flash GameInput API (Getting Started)<\/strong><\/p>\n<p>For starters I&#8217;m on a Mac so getting 2+ Xbox 360 controllers to work is already quite a challenge (I documented how <a href=\"http:\/\/www.nathalielawhead.com\/candybox\/getting-multiple-xbox-360-controllers-working-on-a-mac-os-x-yosemite\" target=\"_blank\">to do this here<\/a>). Apparently PlayStation is a lot easier, and as <a href=\"http:\/\/tattiebogle.net\/index.php\/ProjectRoot\/Ps3Controller\" target=\"_blank\">this site indicates<\/a>: <\/p>\n<blockquote><p>&#8220;Note that for modern versions of Mac OS X there is a PS3 driver built into the OS and this driver is not required.&#8221;<\/p><\/blockquote>\n<p>Once I managed to get multiple 360 controllers hooked up properly (<a href=\"http:\/\/www.nathalielawhead.com\/candybox\/getting-multiple-xbox-360-controllers-working-on-a-mac-os-x-yosemite\" target=\"_blank\">link again<\/a>), I started digging around for how to do this thing.<\/p>\n<p>Reading <a href=\"http:\/\/help.adobe.com\/en_US\/FlashPlatform\/reference\/actionscript\/3\/flash\/ui\/GameInput.html\" target=\"_blank\">the docs<\/a> and <a href=\"http:\/\/www.adobe.com\/devnet\/air\/articles\/game-controllers-on-air.html\" target=\"_blank\">Game controllers on Adobe AIR<\/a> wasn&#8217;t clear enough for me (seemed a bit convoluted, or I just say that because it was late at night).<br \/>\nI couldn&#8217;t get it to work at first. I thought it was because I didn&#8217;t set up the Xbox controller right (Mac insecurities), but after some digging I found that <a href=\"https:\/\/forums.adobe.com\/search.jspa?q=GameInput\" target=\"_blank\">PC users have some of the same issues<\/a>.<br \/>\nThere is also a <a href=\"https:\/forums.adobe.com\/message\/5443602#5443602\" target=\"_blank\">wonderful code snippet in this post here<\/a> that can get you started right away in testing&#8230; just so you see another number but <code>0<\/code> for <code>numDevices<\/code>.<br \/>\nLike the <a href=\"http:\/\/www.adobe.com\/devnet\/air\/articles\/game-controllers-on-air.html\" target=\"_blank\">devnet article<\/a> suggests you have to add the listeners <code>DEVICE_ADDED<\/code>, <code>DEVICE_REMOVED<\/code>, <code>DEVICE_UNUSABLE<\/code> to your <code>GameInput<\/code> instance for it to work properly.<br \/>\nI had a phase where <code>numDevices<\/code> was constantly returning <code>0<\/code>. Apparently unplugging and re-plugging in the controller can fix this. In my case I restarted the computer and then it worked.<br \/>\nIf you&#8217;re like me you want some code samples, just to get a general understanding of what needs to be done. Unfortunately these are terribly lacking in <a href=\"http:\/\/help.adobe.com\/en_US\/FlashPlatform\/reference\/actionscript\/3\/flash\/ui\/GameInput.html\" target=\"_blank\">Adobe&#8217;s documentation<\/a>, but I found the following to be very helpful.<br \/>\nzehfernando has a wonderful example in <del datetime=\"2016-07-30T19:03:59+00:00\"><a href=\"https:\/\/github.com\/zeh\/key-action-binder\/blob\/master\/tests\/GameInputTester\/src\/src\/com\/zehfernando\/gameinputtester\/display\/Main.as\" target=\"_blank\">plain common english here<\/a>.<\/del> Update: The project <a href=\"https:\/\/github.com\/zeh\/key-action-binder-as3\">has been moved here<\/a>.<br \/>\n<a href=\"http:\/\/itouhiro.hatenablog.com\/entry\/20140914\/flash\" target=\"_blank\">This post (here) I also found very helpful<\/a> (gives you an idea of what you need to do).<br \/>\n<a href=\"http:\/\/cuaoar.jp\/2013\/04\/adobe-air-gameinput.html\" target=\"_blank\">And this post here<\/a> finally eliminated any further confusion for me.<br \/>\nThe last two code samples in the .jp sites are very self-explanatory.<\/p>\n<p>I also quickly put this sample together to give anybody (maybe Google-ing) a general idea of all the info you can capture with this&#8230;<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #008800; font-weight: bold\">import<\/span> <span style=\"color: #0e84b5; font-weight: bold\">flash.ui.GameInput<\/span><span style=\"color: #333333\">;<\/span>\r\n\r\n<span style=\"color: #888888\">\/\/quick through-together copy &amp; paste test<\/span>\r\n\r\nvar gameInput <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">GameInput<\/span><span style=\"color: #333333\">();<\/span>\r\n\r\ngameInput<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">addEventListener<\/span><span style=\"color: #333333\">(<\/span>GameInputEvent<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">DEVICE_ADDED<\/span><span style=\"color: #333333\">,<\/span> GIE_added<span style=\"color: #333333\">);<\/span>\r\ngameInput<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">addEventListener<\/span><span style=\"color: #333333\">(<\/span>GameInputEvent<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">DEVICE_REMOVED<\/span><span style=\"color: #333333\">,<\/span> GIE_onRemoved<span style=\"color: #333333\">);<\/span>\r\ngameInput<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">addEventListener<\/span><span style=\"color: #333333\">(<\/span>GameInputEvent<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">DEVICE_UNUSABLE<\/span><span style=\"color: #333333\">,<\/span> GIE_unusable<span style=\"color: #333333\">);<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> device:<span style=\"color: #333399; font-weight: bold\">GameInputDevice<\/span><span style=\"color: #333333\">;<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> control:<span style=\"color: #333399; font-weight: bold\">GameInputControl<\/span><span style=\"color: #333333\">;<\/span>\r\n\r\n\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">GIE_added<\/span><span style=\"color: #333333\">(<\/span>gameInputEvent<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">GameInputEvent<\/span><span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">{<\/span>\r\n\t<span style=\"color: #888888\">\/\/<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;Controller Added! GameInput.numDevices is &quot;<\/span> <span style=\"color: #333333\">+<\/span> GameInput<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">numDevices<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;GameInput.getDeviceAt(0): &quot;<\/span><span style=\"color: #333333\">+<\/span>GameInput<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">getDeviceAt<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">));<\/span>\r\n\t<span style=\"color: #888888\">\/\/Controller #1 - lazy test<\/span>\r\n\tdevice <span style=\"color: #333333\">=<\/span> GameInput<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">getDeviceAt<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/get all the buttons (loop through number of controls) and add the on change listener<\/span>\r\n\t<span style=\"color: #888888\">\/\/this indicates if a button pressed, and gets the value...<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">for<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #008800; font-weight: bold\">var<\/span> i:<span style=\"color: #333399; font-weight: bold\">Number<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">;<\/span> i<span style=\"color: #333333\">&lt;<\/span>device<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">numControls<\/span><span style=\"color: #333333\">;<\/span> <span style=\"color: #333333\">++<\/span>i<span style=\"color: #333333\">){<\/span>\r\n\t\tcontrol <span style=\"color: #333333\">=<\/span> device<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">getControlAt<\/span><span style=\"color: #333333\">(<\/span>i<span style=\"color: #333333\">);<\/span>\r\n\t\tcontrol<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">addEventListener<\/span><span style=\"color: #333333\">(<\/span>Event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">CHANGE<\/span><span style=\"color: #333333\">,<\/span> GIE_onChange<span style=\"color: #333333\">);\/\/<\/span>capture change\r\n\t\t<span style=\"color: #888888\">\/\/what buttons does it have (names)<\/span>\r\n\t\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;CONTROLS: &quot;<\/span><span style=\"color: #333333\">+<\/span>control<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">id<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #333333\">}<\/span>\r\n\t<span style=\"color: #888888\">\/\/set to enabled<\/span>\r\n\tdevice<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">enabled<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">true<\/span><span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #888888\">\/\/return info<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;device.enabled - &quot;<\/span> <span style=\"color: #333333\">+<\/span> device<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">enabled<\/span><span style=\"color: #333333\">);<\/span> \r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;device.id - &quot;<\/span> <span style=\"color: #333333\">+<\/span> device<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">id<\/span><span style=\"color: #333333\">);<\/span> \r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;device.name - &quot;<\/span> <span style=\"color: #333333\">+<\/span> device<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">name<\/span><span style=\"color: #333333\">);<\/span> \r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;device.numControls - &quot;<\/span> <span style=\"color: #333333\">+<\/span> device<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">numControls<\/span><span style=\"color: #333333\">);<\/span> \r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;device.sampleInterval - &quot;<\/span> <span style=\"color: #333333\">+<\/span> device<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">sampleInterval<\/span><span style=\"color: #333333\">);<\/span> \r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;device.MAX_BUFFER - &quot;<\/span> <span style=\"color: #333333\">+<\/span> GameInputDevice<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">MAX_BUFFER_SIZE<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;device.numControls - &quot;<\/span> <span style=\"color: #333333\">+<\/span> device<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">numControls<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">GIE_onChange<\/span><span style=\"color: #333333\">(<\/span>event<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Event<\/span><span style=\"color: #333333\">){<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> control:<span style=\"color: #333399; font-weight: bold\">GameInputControl<\/span> <span style=\"color: #333333\">=<\/span> event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">target<\/span> <span style=\"color: #008800; font-weight: bold\">as<\/span> GameInputControl<span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #888888\">\/\/To get the value of the press you can use .value, or minValue and maxValue for on\/off<\/span>\r\n\t<span style=\"color: #888888\">\/\/var num_val:Number = control.value;<\/span>\r\n\t<span style=\"color: #888888\">\/\/<\/span>\r\n\t<span style=\"color: #888888\">\/\/constant stream (Axis is very sensitive)<\/span>\r\n\t<span style=\"color: #888888\">\/\/trace(&quot;control.id=&quot; + control.id);<\/span>\r\n\t<span style=\"color: #888888\">\/\/trace(&quot;control.value=&quot; + control.value + &quot; (&quot; + control.minValue+&quot; .. &quot; + control.maxValue+&quot;)&quot;);<\/span>\r\n\t<span style=\"color: #888888\">\/\/<\/span>\r\n\t<span style=\"color: #888888\">\/\/trace just on\/off to see each button<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">if<\/span><span style=\"color: #333333\">(<\/span>control<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">value<\/span> <span style=\"color: #333333\">&gt;=<\/span> control<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">maxValue<\/span><span style=\"color: #333333\">){<\/span>\r\n\t\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;control.id=&quot;<\/span> <span style=\"color: #333333\">+<\/span> control<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">id<\/span> <span style=\"color: #333333\">+<\/span><span style=\"background-color: #fff0f0\">&quot; has been pressed&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #333333\">}<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">GIE_onRemoved<\/span><span style=\"color: #333333\">(<\/span>gameInputEvent<span style=\"color: #333333\">:<\/span> <span style=\"color: #333399; font-weight: bold\">GameInputEvent<\/span><span style=\"color: #333333\">){<\/span>\r\n\t<span style=\"color: #888888\">\/\/detects if you unplugged it<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;Controller Removed.&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;GameInput.numDevices: &quot;<\/span> <span style=\"color: #333333\">+<\/span> GameInput<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">numDevices<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">GIE_unusable<\/span><span style=\"color: #333333\">(<\/span>gameInputEvent<span style=\"color: #333333\">:<\/span> <span style=\"color: #333399; font-weight: bold\">GameInputEvent<\/span><span style=\"color: #333333\">){<\/span>\r\n\t<span style=\"color: #888888\">\/\/throw error now...<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;Controller Unusable.&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;GameInput.numDevices: &quot;<\/span> <span style=\"color: #333333\">+<\/span> GameInput<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">numDevices<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n<\/pre>\n<\/div>\n<p>Although the <code>GameInputController<\/code> is not <em>exclusive<\/em> to AIR anymore, and will &#8220;work&#8221; (with mixed results) in the browser (from my testing it is perfect in AIR, works in Firefox, but not Crome or Safari).<br \/>\nAlso from my reading there are some caveats to running this in the browser, I quote from a <a href=\"http:\/\/stackoverflow.com\/questions\/21870953\/gameinput-api-doesnt-work-once-the-swf-is-embedded-in-a-html-page\" target=\"_blank\">helpful answer at stackoverflow<\/a>:<\/p>\n<blockquote><p>Not all devices work; some fringe devices may get ignored by Flash.<\/p>\n<p>Sometimes the addition of devices that are supported don&#8217;t really work &#8211; you may have to disconnect and reconnect them to get them to work.<\/p>\n<p>Sometimes when using multiple controllers of the same type they get mixed up and only one of them will work.<\/p>\n<p>Actual reported control ids vary between the Plugin\/ActiveX version of Flash (Firefox\/Safari\/IE\/etc) and Pepper (Chrome).<\/p>\n<p>You usually need to press a button with the proper SWF focused for the GameInputDevice to be detected and reported.<\/p><\/blockquote>\n<p>There is also a <a href=\"https:\/\/docs.google.com\/spreadsheet\/ccc?key=0AkkprH0hOE5cdGpmeDVTVFQ5M0syOGdXZ0xjVDJkSnc&#038;usp=sharing#gid=1\" target=\"_blank\">spreadsheet of known GameInput controls here<\/a> (not that old too), via <a href=\"http:\/\/zehfernando.com\/2013\/playstation-4-controller-in-adobe-air-and-flash\/\" target=\"_blank\">this post<\/a>.<\/p>\n<p>After having <a href=\"https:\/\/github.com\/zeh\/key-action-binder\/tree\/master\/tests\/GameInputTester\/src\" target=\"_blank\">found this on github<\/a> I found <a href=\"https:\/\/github.com\/zeh\/key-action-binder-as3\" target=\"_blank\">zehfernando KeyActionBinder project<\/a>. It&#8217;s a very impressive one, and seems to have solved many of the problems I see I will have.<br \/>\nIt will work on Mac\/Windows.<\/p>\n<p>There <a href=\"http:\/\/rhuno.com\/flashblog\/airxbc\/\" target=\"_blank\">is also Airxbc<\/a>, but this is Windows only.<\/p>\n<p>I also found <a href=\"http:\/\/blog.jdpalmer.org\/2013\/09\/writing-portable-code-with-adobe-airs.html\" target=\"_blank\">James Dean Palmer Gamepad classes<\/a>.<\/p>\n<p>Although I like <a href=\"http:\/\/zehfernando.com\/2013\/abstracting-key-and-game-controller-inputs-in-adobe-air\/\" target=\"_blank\">zehfernando&#8217;s project<\/a> better from all the others. I recommend that one. His <a href=\"http:\/\/zehfernando.com\/2014\/keyactionbinder-is-growing-up\/\" target=\"_blank\">blog posts<\/a> about his project where a trove of helpful information so I recommend anybody new to this to dive in and start digging <a href=\"http:\/\/zehfernando.com\/2013\/abstracting-key-and-game-controller-inputs-in-adobe-air\/\" target=\"_blank\">at his website<\/a>.<br \/>\nI got it running in no time, and it was very straightforward.<\/p>\n<p>Update: the <a href=\"https:\/\/github.com\/zeh\/key-action-binder-as3\">as3 version of key-action-binder is here<\/a>. It is old, so if you intend to use it you will have to update the json file else it will not work with Windows. Alternatively, I have found out that you can use any javascript version with your actionscript project and it will work good too, so this is worth taking into consideration.<\/p>\n<p>Ok&#8230; now to start making my 2 player+ game&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update (May 29, 2016): emmett butler has an even more thorough post on the topic here, NativeJoystick in Bum Rush I suggest starting with that since his post is a lot more in depth. I had been emailed about this issue (problems with GameInput) and gave some links that I thought helpful at the time I was working with controllers. Here they are in the event they can help others: * NativeJoystick: AIR \u201cANE\u201d extension to support all joysticks that Windows can. * Topic: NativeJoystick: AIR \u201cANE\u201d extension to support all joysticks that Windows can. * Joystick Library for Adobe&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":4522,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[30,12],"tags":[],"class_list":["post-3328","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-games","category-resources"],"_links":{"self":[{"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts\/3328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/comments?post=3328"}],"version-history":[{"count":14,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts\/3328\/revisions"}],"predecessor-version":[{"id":3577,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts\/3328\/revisions\/3577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/media\/4522"}],"wp:attachment":[{"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/media?parent=3328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/categories?post=3328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/tags?post=3328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}