AIRControl - Adobe AIR Game Controller Native Extension - API Documentation | All Packages | All Classes | Index | Frames No Frames |
AIRControl

Package | com.alexomara.ane.AIRControl
Class | public class AIRControl
Inheritance | AIRControl Object
Implements | flash.events.IEventDispatcher

The AIRControl static class is used to interface with the AIRControl native extension.

This class cannot be instantiated and will throw an error if attempted. All properties and methods must be used statically.

Public Properties

| Property | Defined By
--- | --- | ---
|  | controllersTotal : uint [static] [read-only] The total controllers currently connected. | AIRControl
|  | debugOutput : Function = null [static] Set to a function that takes a single string argument to get debug output. | AIRControl

Public Methods

| Method | Defined By
--- | --- | ---
|  | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void [static] | AIRControl
|  | controller(index:uint):AIRControlController [static] Returns the controller at a specific index. | AIRControl
|  | dispatchEvent(event:Event):Boolean [static] | AIRControl
|  | dispose():void [static] Detaches all the controllers and disposes of the native extension context. | AIRControl
|  | hasEventListener(type:String):Boolean [static] | AIRControl
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void [static] | AIRControl
|  | update():void [static] Updates the controller states. | AIRControl
|  | willTrigger(type:String):Boolean [static] | AIRControl

Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | AIRControlEvent.controllerAttach | Dispatched on controller attach. | AIRControl
|  | AIRControlEvent.controllerDetach | Dispatched on controller detach. | AIRControl

Public Constants

| Constant | Defined By
--- | --- | ---
|  | REVISION : Number = 0.0 [static] The revision and build numbers of this extension. | AIRControl
|  | VERSION : Number = 1.1 [static] The major and minor versions of this extension. | AIRControl

Property Detail

controllersTotal | property

`controllersTotal:uint` [read-only]

The total controllers currently connected.

- On Windows the maximum supported controllers is determined by joyGetNumDevs(), which returns 16 on current versions of Windows.
- On Mac OS X there is no explicitly imposed limit.

Implementation
`public static function get controllersTotal():uint`

See also

controller()

debugOutput | property |

`public static var debugOutput:Function = null`

Set to a function that takes a single string argument to get debug output. Set to null to disable.

Method Detail

addEventListener | () | method

`public static function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void`

Parameters

| `type:String`
| `listener:Function`
| `useCapture:Boolean` (default = `false`)``
| `priority:int` (default = `0`)``
| `useWeakReference:Boolean` (default = `false`)``

See also

com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_ATTACH
com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_DETACH

controller | () | method |

`public static function controller(index:uint):AIRControlController`

Returns the controller at a specific index.

Game controller index positions are dynamic and change when controllers of lower index are detached. If a controller is detached, higher indexed controllers will shift lower to fill the space. If the controller is reattached, it is appended to the end of the list.

To avoid issues with referencing disconnected controllers, it is better to match controllers with CONTROLLER_ATTACH and CONTROLLER_DETACH.

Parameters

| `index:uint` — The index of the controller element.

Returns

| `AIRControlController` — The controller at the specified index or null.

See also

controllersTotal
com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_ATTACH
com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_DETACH

dispatchEvent | () | method |

`public static function dispatchEvent(event:Event):Boolean`

Parameters

| `event:Event`

Returns

| `Boolean`

See also

com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_ATTACH
com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_DETACH

dispose | () | method |

`public static function dispose():void`

Detaches all the controllers and disposes of the native extension context.

If the extensions will not be used for a period of time, this can be used to free up memory. Each currently connected controller will fire the CONTROLLER_DETACH event counting down.

See also

com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_DETACH

hasEventListener | () | method |

`public static function hasEventListener(type:String):Boolean`

Parameters

| `type:String`

Returns

| `Boolean`

See also

com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_ATTACH
com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_DETACH

removeEventListener | () | method |

`public static function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void`

Parameters

| `type:String`
| `listener:Function`
| `useCapture:Boolean` (default = `false`)``

See also

com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_ATTACH
com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_DETACH

update | () | method |

`public static function update():void`

Updates the controller states.

Calls the method in the native code to get the current state of the controllers, updates all the controllers, and dispatches events. This function must be called manually every time the application should recieve updated controller information such as on ENTER_FRAME or EXIT_FRAME.

This function will also create the native extension context on first call and any first calls following the dispose method.

- On Windows checking for new controllers is limited to once per second to avoid performance issues.
- On Mac OS X new controllers are detected immediately.

See also

com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_ATTACH
com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_DETACH
com.alexomara.ane.AIRControl.events.AIRControlControllerEvent.AXIS_CHANGE
com.alexomara.ane.AIRControl.events.AIRControlControllerEvent.POV_CHANGE
com.alexomara.ane.AIRControl.events.AIRControlControllerEvent.BUTTON_CHANGE
dispose()

willTrigger | () | method |

`public static function willTrigger(type:String):Boolean`

Parameters

| `type:String`

Returns

| `Boolean`

See also

com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_ATTACH
com.alexomara.ane.AIRControl.events.AIRControlEvent.CONTROLLER_DETACH
Event Detail

AIRControlEvent.controllerAttach | Event

Event Object Type: `com.alexomara.ane.AIRControl.events.AIRControlEvent`
AIRControlEvent.type property = `com.alexomara.ane.AIRControl.events.AIRControlEvent`

Dispatched on controller attach.

AIRControlEvent.controllerDetach | Event |

Event Object Type: `com.alexomara.ane.AIRControl.events.AIRControlEvent`
AIRControlEvent.type property = `com.alexomara.ane.AIRControl.events.AIRControlEvent`

Dispatched on controller detach.

Constant Detail

REVISION | Constant

`public static const REVISION:Number = 0.0`

The revision and build numbers of this extension.

VERSION | Constant |

`public static const VERSION:Number = 1.1`

The major and minor versions of this extension.

Mon Jul 22 2013, 09:56 PM -04:00