ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
flash.ui 

GameInputControl  - AS3

Packageflash.ui
Classpublic dynamic class GameInputControl
InheritanceGameInputControl Inheritance EventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Runtime Versions: AIR 3.7

The GameInputControl class represents a control on an input device. The GameInput API maps the physical controls on a device to simple logical controls.

Getting Control Values:

The value property returns the current value of a control. This method does not return the latest value directly from the control. Instead it returns the value that was cached the last time the control was sampled.

There are three ways to get control values from an individual control:

  1. Polling: Call value whenever you want to get the last known value for a control.
  2. Change Events: Register a change event for a controller. The Event.CHANGE event is dispatched whenever the value of a control changes. Upon receiving the event, call value to get the value for the control that fired the event.
  3. Caching Sample Values: Caching is done at the device level. See the GameInputDevice class documentation for details on caching and retrieving sampled control values.

Attempting to read control values from a disabled device causes value to throw an IOError. However, you can access properties describing a control ( id, minValue and maxValue) even if the device is not enabled. This feature makes it possible to determine if a device fits the needs of your application, without having to first enable the device.

Related API Elements



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
      device : GameInputDevice
[read-only] Returns the GameInputDevice object that contains this control.
GameInputControl
      id : String
[read-only] Returns the id of this control.
GameInputControl
      maxValue : Number
[read-only] Returns the maximum value for this control.
GameInputControl
      minValue : Number
[read-only] Returns the minimum value for this control.
GameInputControl
      value : Number
[read-only] Returns the value for this control.
GameInputControl
Public Methods
 MethodDefined By
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
  Dispatched when a control value changes.GameInputControl
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
Property Detail
    

device

property
device:GameInputDevice  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 3.7

Returns the GameInputDevice object that contains this control.



Implementation
    public function get device():GameInputDevice
    

id

property 
id:String  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 3.7

Returns the id of this control.



Implementation
    public function get id():String
    

maxValue

property 
maxValue:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 3.7

Returns the maximum value for this control.



Implementation
    public function get maxValue():Number
    

minValue

property 
minValue:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 3.7

Returns the minimum value for this control.



Implementation
    public function get minValue():Number
    

value

property 
value:Number  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: AIR 3.7

Returns the value for this control.



Implementation
    public function get value():Number

Throws
IOError — When value is called while the device is disabled.
Event Detail

change

Event
Event Object Type: flash.events.Event

Dispatched when a control value changes.