Packagecom.alexomara.ane.AIRControl
Classpublic class AIRControl
InheritanceAIRControl Inheritance 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
 PropertyDefined 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
 MethodDefined By
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
[static]
AIRControl
  
[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
  Dispatched on controller attach.AIRControl
  Dispatched on controller detach.AIRControl
Public Constants
 ConstantDefined 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
controllersTotalproperty
controllersTotal:uint  [read-only]

The total controllers currently connected.


Implementation
    public static function get controllersTotal():uint

See also

debugOutputproperty 
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

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

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

Parameters

event:Event

Returns
Boolean

See also

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

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

Parameters

type:String

Returns
Boolean

See also

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

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.

See also

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

Parameters

type:String

Returns
Boolean

See also

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
REVISIONConstant
public static const REVISION:Number = 0.0

The revision and build numbers of this extension.

VERSIONConstant 
public static const VERSION:Number = 1.1

The major and minor versions of this extension.