Package | com.distriqt.extension.gyroscope |
Class | public class Gyroscope |
Inheritance | Gyroscope flash.events.EventDispatcher |
This class represents the gyroscope sensor.
Provides gyroscope information, i.e. rotation rates about each of the X, Y, Z axis.
Always verify that a sensor exists on a device before you attempt to acquire data from it. Don't assume that a sensor exists simply because it's a frequently-used sensor. Device manufacturers are not required to provide any particular sensors in their devices.
NoteWe've moved the sensor fusion calculations of device orientation and motion to another extension. This extension will simply be information about the Gyroscope sensor.
Property | Defined By | ||
---|---|---|---|
implementation : String [read-only]
The implementation currently in use. | Gyroscope | ||
isAdvancedDataSupported : Boolean Deprecated: Advanced Data is no longer supported in this extension. Use the device motion extension for this information [static] [read-only]
This determines whether the device can provide advanced
gyroscopic data. | Gyroscope | ||
isRegistered : Boolean [read-only]
Whether the extension has been registered to listen to the sensor output
| Gyroscope | ||
isSupported : Boolean [static] [read-only]
Whether the current device supports the extensions functionality
If this is true then you'll at least have access to the raw
x,y,z values of the gyroscope sensor. | Gyroscope | ||
nativeVersion : String [read-only]
The native version string of the native extension. | Gyroscope | ||
service : Gyroscope [static] [read-only]
The singleton instance of the Extension class. | Gyroscope | ||
version : String [read-only]
The version of this extension. | Gyroscope |
Method | Defined By | ||
---|---|---|---|
Constructor
You should not call this directly, but instead use the singleton access, eg:
Gyroscope.service.register();
| Gyroscope | ||
dispose():void
Disposes the extension and releases any allocated resources. | Gyroscope | ||
init(key:String):void Deprecated: You no longer need to use an application key [static]
Initialises the extension class for use with the provided key. | Gyroscope | ||
register(rate:int):void
Register with the gyroscope service to start retrieving the
information from the sensor. | Gyroscope | ||
unregister():void
Unregister the gyroscope sensor listening
Be sure to unregister a sensor's listener when you are done using
the sensor or when the sensor activity pauses. | Gyroscope |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when a gyroscope update is received | Gyroscope |
Constant | Defined By | ||
---|---|---|---|
EXT_CONTEXT_ID : String = com.distriqt.Gyroscope [static] | Gyroscope | ||
SENSOR_DELAY_FASTEST : int = 0 [static]
get sensor data as fast as possible
| Gyroscope | ||
SENSOR_DELAY_GAME : int = 1 [static]
rate suitable for games
| Gyroscope | ||
SENSOR_DELAY_NORMAL : int = 3 [static]
rate (default) suitable for screen orientation changes
| Gyroscope | ||
SENSOR_DELAY_UI : int = 2 [static]
rate suitable for the user interface
| Gyroscope | ||
VERSION : String = 3.2.0 [static] | Gyroscope |
implementation | property |
implementation:String
[read-only]
The implementation currently in use. This should be one of the following depending on the platform in use and the functionality supported by this extension:
Android
iOS
default
unknown
public function get implementation():String
isAdvancedDataSupported | property |
isAdvancedDataSupported:Boolean
[read-only]
This determines whether the device can provide advanced gyroscopic data. This advanced data uses the magnetic and accelerometer data to calculate the devices pitch, roll and azimuth.
If this is false, you will still have access to the raw x,y,z values of the gyroscope sensor.
public static function get isAdvancedDataSupported():Boolean
See also
isRegistered | property |
isRegistered:Boolean
[read-only] Whether the extension has been registered to listen to the sensor output
public function get isRegistered():Boolean
isSupported | property |
isSupported:Boolean
[read-only]
Whether the current device supports the extensions functionality
If this is true then you'll at least have access to the raw x,y,z values of the gyroscope sensor.
public static function get isSupported():Boolean
See also
nativeVersion | property |
nativeVersion:String
[read-only]
The native version string of the native extension.
public function get nativeVersion():String
service | property |
service:Gyroscope
[read-only] The singleton instance of the Extension class.
public static function get service():Gyroscope
version | property |
version:String
[read-only]
The version of this extension.
This should be of the format, MAJOR.MINOR.BUILD
public function get version():String
Gyroscope | () | Constructor |
public function Gyroscope()
Constructor You should not call this directly, but instead use the singleton access, eg: Gyroscope.service.register();
dispose | () | method |
public function dispose():void
Disposes the extension and releases any allocated resources. Once this function
has been called, a call to init
is neccesary again before any of the
extensions functionality will work.
init | () | method |
public static function init(key:String):void
Initialises the extension class for use with the provided key.
Parameters
key:String |
register | () | method |
public function register(rate:int):void
Register with the gyroscope service to start retrieving the information from the sensor.
You can specify the rate at which the sensors are updated on both Android and iOS. The rates are predefined values.
Parameters
rate:int (default = NaN ) — The SENSOR_DELAY_value to use as
the sensor update rate.
Default is SENSOR_DELAY_NORMAL
|
See also
unregister | () | method |
public function unregister():void
Unregister the gyroscope sensor listening
Be sure to unregister a sensor's listener when you are done using the sensor or when the sensor activity pauses. If a sensor listener is registered and its activity is paused, the sensor will continue to acquire data and use battery resources unless you unregister the sensor.
See also
gyroscope:update | Event |
com.distriqt.extension.gyroscope.events.GyroscopeEvent
com.distriqt.extension.gyroscope.events.GyroscopeEvent.UPDATE
Dispatched when a gyroscope update is received
EXT_CONTEXT_ID | Constant |
public static const EXT_CONTEXT_ID:String = com.distriqt.Gyroscope
SENSOR_DELAY_FASTEST | Constant |
public static const SENSOR_DELAY_FASTEST:int = 0
get sensor data as fast as possible
SENSOR_DELAY_GAME | Constant |
public static const SENSOR_DELAY_GAME:int = 1
rate suitable for games
SENSOR_DELAY_NORMAL | Constant |
public static const SENSOR_DELAY_NORMAL:int = 3
rate (default) suitable for screen orientation changes
SENSOR_DELAY_UI | Constant |
public static const SENSOR_DELAY_UI:int = 2
rate suitable for the user interface
VERSION | Constant |
public static const VERSION:String = 3.2.0