Airxbc

This page contains the most recent version of Airxbc and information on how to use it.

Last Updated: December 30, 2012

Airxbc Version: 1.0

Airxbc Documentation: Airxbc 1.0 Documentation

Airxbc ANE File: Airxbc 1.0

Airxbc Demo Project: Airxbc 1.0 Demo

The latest update to Airxbc brings new functionality in addition to some slight changes to the way some things worked in previous versions.

Airxbc is Windows only.

New Features

Support for multiple controllers. A new method, getNumControllers, will return the number of connected controllers that have been detected by Airxbc.


The X360Gamepad class now has support for the left and right thumbstick buttons:

(X360Gamepad.GAMEPAD_STICK_LEFT, X360Gamepad.GAMEPAD_STICK_RIGHT)

As with other buttons, you can now detect if the thumbsticks are pressed or released via the following methods:

  • isLeftStickButtonPressed
  • isRightStickButtonPressed
  • wasLeftStickButtonReleased
  • wasRightStickButtonReleased
  • wasLeftStickButtonJustPressed
  • wasRightStickButtonJustPressed
  • isButtonDown
  • wasButtonReleased
  • wasButtonJustPressed

The X360Gamepad class now allows you to detect if a button was just pressed down or not. You can use any of the following methods:

  • wasAJustPressed
  • wasBJustPressed
  • wasXJustPressed
  • wasYJustPressed
  • wasBackJustPressed
  • wasStartJustPressed
  • wasLeftShoulderJustPressed
  • wasRightShoulderJustPressed
  • wasLeftStickButtonJustPressed
  • wasRightStickButtonJustPressed
  • wasButtonJustPressed


Updated Features

The pollGamePad method now accepts an optional parameter, controllerIndex, to specify which controller to retrieve data from. Valid values are 0 through 3. If no value is supplied, the method uses index 0 by default.

NOTE: While the extension should support 4 controllers, it has only been tested with 2! Please let me know if you experience issues.


The setVibration method now accepts 3 parameters instead of 2. The first parameter is the controller index, the second parameter is the left motor vibration speed and the final parameter is the right motor vibration speed.

Additionally, the left and right motor speeds are now set using a value between 0 (no vibration) and 1 (full vibration).

Error Info

If pollGamePad cannot obtain information from the requested controller, it will generate an error:
"Gamepad object error #: 9001."

In most cases, the cause of this is that the controller is not connected. It is recommended that you wrap a call to the method in a try/catch block, or call getNumControllers first to ensure at least one controller is connected.

Sample Code

import com.rhuno.Airxbc;  
import com.rhuno.X360Gamepad;  
  
var ext:Airxbc = new Airxbc();  
var gpad0:X360Gamepad;  
var gpad1:X360Gamepad;

gpad0 = ext.pollGamePad();  // index 0 is used if no parameter is supplied
gpad1 = ext.pollGamePad(1);  

// various ways of checking for button presses  
gpad0.isXButtonDown();  
gpad1.isButtonDown(X360Gamepad.GAMEPAD_X);  
  
// ways of checking if a button was just pressed  
gpad0.wasAJustPressed()
gpad1.wasButtonJustPressed(X360Gamepad.GAMEPAD_STICK_LEFT);  

// ways of checking for button releases  
gpad0.wasLeftShoulderReleased();  
gpad1.wasButtonReleased(X360Gamepad.GAMEPAD_LEFT_SHOULDER);  
  
// get trigger value  
var value:int = gpad0.leftTrigger;  
  
// get trigger percentage (0 thru 1)  
var percent:Number = gpad0.leftTriggerAsPercent;  
  
// NOTE: you still use the extension to set vibration  
ext.setVibration(0, 0.5, 0.5); // vibrate the first controller at half speed on both motors
Subscribe to RSS feed FGS5 Badge