Packagecom.distriqt.extension.gyroscope
Classpublic class Gyroscope
InheritanceGyroscope Inheritance 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.

Note

We've moved the sensor fusion calculations of device orientation and motion to another extension. This extension will simply be information about the Gyroscope sensor.



Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
Events
 Event Summary Defined By
   Dispatched when a gyroscope update is received Gyroscope
Public Constants
 ConstantDefined 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
Property Detail
implementationproperty
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:


Implementation
    public function get implementation():String
isAdvancedDataSupportedproperty 
isAdvancedDataSupported:Boolean  [read-only]
Deprecated: Advanced Data is no longer supported in this extension. Use the device motion extension for this information

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.


Implementation
    public static function get isAdvancedDataSupported():Boolean

See also

isRegisteredproperty 
isRegistered:Boolean  [read-only]

Whether the extension has been registered to listen to the sensor output


Implementation
    public function get isRegistered():Boolean
isSupportedproperty 
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.


Implementation
    public static function get isSupported():Boolean

See also

nativeVersionproperty 
nativeVersion:String  [read-only]

The native version string of the native extension.


Implementation
    public function get nativeVersion():String
serviceproperty 
service:Gyroscope  [read-only]

The singleton instance of the Extension class.


Implementation
    public static function get service():Gyroscope
versionproperty 
version:String  [read-only]

The version of this extension.

This should be of the format, MAJOR.MINOR.BUILD


Implementation
    public function get version():String
Constructor Detail
Gyroscope()Constructor
public function Gyroscope()

Constructor You should not call this directly, but instead use the singleton access, eg: Gyroscope.service.register();

Method Detail
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
Deprecated: You no longer need to use an application key

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

Event Detail
gyroscope:update Event
Event Object Type: com.distriqt.extension.gyroscope.events.GyroscopeEvent
GyroscopeEvent.type property = com.distriqt.extension.gyroscope.events.GyroscopeEvent.UPDATE

Dispatched when a gyroscope update is received
Constant Detail
EXT_CONTEXT_IDConstant
public static const EXT_CONTEXT_ID:String = com.distriqt.Gyroscope

SENSOR_DELAY_FASTESTConstant 
public static const SENSOR_DELAY_FASTEST:int = 0

get sensor data as fast as possible

SENSOR_DELAY_GAMEConstant 
public static const SENSOR_DELAY_GAME:int = 1

rate suitable for games

SENSOR_DELAY_NORMALConstant 
public static const SENSOR_DELAY_NORMAL:int = 3

rate (default) suitable for screen orientation changes

SENSOR_DELAY_UIConstant 
public static const SENSOR_DELAY_UI:int = 2

rate suitable for the user interface

VERSIONConstant 
public static const VERSION:String = 3.2.0