Language version: | ActionScript 3.0 |
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:
-
Polling: Call
value
whenever you want
to get the last known value for a control.
-
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.
-
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.
For more information, see the Adobe Air Developer Center article:
Game controllers on Adobe AIR.
For Android, this feature supports a minimum Android OS version of 4.1 and
requires the minimum SWF version 20 and namespace 3.7.
For iOS, this feature supports a minimum iOS version of 9.0 and requires
the minimum SWF version 34 and namespace 23.0.
device:GameInputDevice
[read-only]
Language version: | ActionScript 3.0 |
Returns the GameInputDevice object that contains this control.
Implementation
public function get device():GameInputDevice
id:String
[read-only]
Language version: | ActionScript 3.0 |
Returns the id of this control.
Implementation
public function get id():String
maxValue:Number
[read-only]
Language version: | ActionScript 3.0 |
Returns the maximum value for this control.
Implementation
public function get maxValue():Number
minValue:Number
[read-only]
Language version: | ActionScript 3.0 |
Returns the minimum value for this control.
Implementation
public function get minValue():Number
value:Number
[read-only]
Language version: | ActionScript 3.0 |
Returns the value for this control.
Implementation
public function get value():Number
Throws
| Error — When value is called while the device is
disabled.
|
Event object type: flash.events.Event
Dispatched when a control value changes.
© 2004-2022 Adobe Systems Incorporated. All rights reserved.
Wed Sep 28 2022, 6:12 PM GMT+01:00