PageRenderTime 77ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/frameworks/projects/playerglobal/bundles/en_US/docs/flash.sensors.xml

https://github.com/adufilie/flex-sdk
XML | 344 lines | 283 code | 43 blank | 18 comment | 0 complexity | fb4cdba72a15ba92c9633361248498f3 MD5 | raw file
Possible License(s): Apache-2.0
  1. <?xml version="1.0" encoding="UTF-8"?><apiPackage xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" id="flash.sensors" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiPackage/apiPackage "><apiName class="- topic/title reference/title apiRef/apiName ">flash.sensors</apiName><apiDetail class="- topic/body reference/refbody apiRef/apiDetail "/><apiClassifier languages="" id="flash.sensors:Accelerometer" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">Accelerometer</apiName><shortdesc class="- topic/shortdesc ">
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. The Accelerometer class dispatches events based on activity detected by the device's motion sensor.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Flash" version="10.1" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Accelerometer class
  17. </apiTipText></apiTipTexts><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">flash.events:EventDispatcher</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  18. The Accelerometer class dispatches events based on activity detected by the device's motion sensor.
  19. This data represents the device's location or
  20. movement along a 3-dimensional axis. When the device moves, the sensor detects this movement and
  21. returns acceleration data. The Accelerometer class provides methods to query whether or not
  22. accelerometer is supported, and also to set the rate at which acceleration events are dispatched.
  23. <p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> Use the <codeph class="+ topic/ph pr-d/codeph ">Accelerometer.isSupported</codeph> property to test the runtime environment for the ability
  24. to use this feature. While the Accelerometer class and its members are accessible to the Runtime Versions listed for
  25. each API entry, the current environment for the runtime determines the availability of this feature. For example, you can
  26. compile code using the Accelerometer class properties for Flash Player 10.1, but you need to use the <codeph class="+ topic/ph pr-d/codeph ">Accelerometer.isSupported</codeph>
  27. property to test for the availability of the Accelerometer feature in the current deployment environment for the Flash Player runtime. If
  28. <codeph class="+ topic/ph pr-d/codeph ">Accelerometer.isSupported</codeph> is <codeph class="+ topic/ph pr-d/codeph ">true</codeph> at runtime, then Accelerometer support currently exists.</p>
  29. <p class="- topic/p "><i class="+ topic/ph hi-d/i ">AIR profile support:</i> This feature is supported
  30. only on mobile devices. It is not supported on desktop or AIR for TV devices. See
  31. <xref href="http://help.adobe.com/en_US/air/build/WS144092a96ffef7cc16ddeea2126bb46b82f-8000.html" class="- topic/xref ">
  32. AIR Profile Support</xref> for more information regarding API support across multiple profiles.
  33. </p>
  34. </apiDesc><example conref="examples\AccelerometerExample.as" class="- topic/example "> In the following example, the application moves a Sprite
  35. based on accelerometer <codeph class="+ topic/ph pr-d/codeph ">update</codeph> events. The accelerometer
  36. <codeph class="+ topic/ph pr-d/codeph ">update</codeph> events indicate movement of the device.
  37. <codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
  38. package
  39. {
  40. import flash.display.Sprite;
  41. import flash.display.StageAlign;
  42. import flash.display.StageScaleMode;
  43. import flash.events.Event;
  44. import flash.events.AccelerometerEvent;
  45. import flash.sensors.Accelerometer;
  46. public class AccelerometerTest extends Sprite
  47. {
  48. private var ball:Sprite;
  49. private var accelerometer:Accelerometer;
  50. private var xSpeed:Number = 0;
  51. private var ySpeed:Number = 0;
  52. private const RADIUS = 20;
  53. public final function AccelerometerTest()
  54. {
  55. stage.scaleMode = StageScaleMode.NO_SCALE;
  56. stage.align = StageAlign.TOP_LEFT;
  57. createBall();
  58. if (Accelerometer.isSupported)
  59. {
  60. accelerometer = new Accelerometer();
  61. accelerometer.addEventListener(AccelerometerEvent.UPDATE, accUpdateHandler);
  62. stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
  63. }
  64. }
  65. private final function createBall():void
  66. {
  67. ball = new Sprite();
  68. ball.graphics.beginFill(0xFF0000);
  69. ball.graphics.drawCircle(0, 0, RADIUS);
  70. ball.cacheAsBitmap = true;
  71. ball.x = stage.stageWidth / 2;
  72. ball.y = stage.stageHeight / 2;
  73. addChild(ball);
  74. }
  75. private final function enterFrameHandler(event:Event):void
  76. {
  77. event.stopPropagation();
  78. moveBall();
  79. }
  80. private final function moveBall():void
  81. {
  82. var newX:Number = ball.x + xSpeed;
  83. var newY:Number = ball.y + ySpeed;
  84. if (newX &lt; 20)
  85. {
  86. ball.x = RADIUS;
  87. xSpeed = 0;
  88. }
  89. else if (newX &gt; stage.stageWidth - RADIUS)
  90. {
  91. ball.x = stage.stageWidth - RADIUS;
  92. xSpeed = 0;
  93. }
  94. else
  95. {
  96. ball.x += xSpeed;
  97. }
  98. if (newY &lt; RADIUS)
  99. {
  100. ball.y = RADIUS;
  101. ySpeed = 0;
  102. }
  103. else if (newY &gt; stage.stageHeight - RADIUS)
  104. {
  105. ball.y = stage.stageHeight - RADIUS;
  106. ySpeed = 0;
  107. }
  108. else
  109. {
  110. ball.y += ySpeed;
  111. }
  112. }
  113. private final function accUpdateHandler(event:AccelerometerEvent):void
  114. {
  115. xSpeed -= event.accelerationX * 2;
  116. ySpeed += event.accelerationY * 2;
  117. }
  118. }
  119. }
  120. </codeblock></example></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.sensors.xml#Accelerometer/isSupported" class="- topic/link "><linktext class="- topic/linktext ">isSupported</linktext></link><link href="flash.events.xml#AccelerometerEvent" class="- topic/link "><linktext class="- topic/linktext ">flash.events.AccelerometerEvent</linktext></link><link href="http://www.riagora.com/2010/04/air-and-the-accelerometer/" class="- topic/link "><linktext class="- topic/linktext ">Michael Chaize: AIR and the Accelerometer</linktext></link><link href="http://www.riagora.com/2010/05/become-an-air-pilot/" class="- topic/link "><linktext class="- topic/linktext ">Michael Chaize: Become an AIR Pilot</linktext></link></related-links><adobeApiEvent id="flash.sensors:Accelerometer_flash.events.StatusEvent.STATUS_status" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef adobeApiEvent/adobeApiEvent "><apiName class="- topic/title reference/title apiRef/apiName ">status</apiName><shortdesc class="- topic/shortdesc ">
  121. Dispatched when an accelerometer changes its status.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Flash" version="10.1" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><adobeApiEventDetail class="- topic/body reference/refbody apiRef/apiDetail adobeApiEvent/adobeApiEventDetail "><adobeApiEventDef class="- topic/section reference/section apiRef/apiDef adobeApiEvent/adobeApiEventDef "><apiEventType class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiEventType ">flash.events.StatusEvent.STATUS</apiEventType><adobeApiEventClassifier class="- topic/xref reference/xref apiRef/apiRelation adobeApiEvent/adobeApiEventClassifier ">flash.events.StatusEvent</adobeApiEventClassifier><apiGeneratedEvent class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiGeneratedEvent "/></adobeApiEventDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  122. Dispatched when an accelerometer changes its status.
  123. <p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> On some devices, the accelerometer is always available.
  124. On such devices, an Accelerometer object never dispatches a <codeph class="+ topic/ph pr-d/codeph ">status</codeph>
  125. event.</p>
  126. </apiDesc></adobeApiEventDetail></adobeApiEvent><adobeApiEvent id="flash.sensors:Accelerometer_flash.events.AccelerometerEvent.UPDATE_update" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef adobeApiEvent/adobeApiEvent "><apiName class="- topic/title reference/title apiRef/apiName ">update</apiName><shortdesc class="- topic/shortdesc ">
  127. The update event is dispatched in response to updates from the accelerometer sensor.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Flash" version="10.1" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><adobeApiEventDetail class="- topic/body reference/refbody apiRef/apiDetail adobeApiEvent/adobeApiEventDetail "><adobeApiEventDef class="- topic/section reference/section apiRef/apiDef adobeApiEvent/adobeApiEventDef "><apiEventType class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiEventType ">flash.events.AccelerometerEvent.UPDATE</apiEventType><adobeApiEventClassifier class="- topic/xref reference/xref apiRef/apiRelation adobeApiEvent/adobeApiEventClassifier ">flash.events.AccelerometerEvent</adobeApiEventClassifier><apiGeneratedEvent class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiGeneratedEvent "/></adobeApiEventDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  128. The <codeph class="+ topic/ph pr-d/codeph ">update</codeph> event is dispatched in response to updates from the accelerometer sensor.
  129. The event is dispatched in the following circumstances:
  130. <p class="- topic/p "><ul class="- topic/ul "><li class="- topic/li ">When a new listener function is attached through <codeph class="+ topic/ph pr-d/codeph ">addEventListener()</codeph>, this event is
  131. delivered once to all the registered listeners for providing the current value of the accelerometer.</li><li class="- topic/li ">Whenever accelerometer updates are obtained from the platform at device determined intervals.</li><li class="- topic/li ">Whenever the application misses a change in the accelerometer (for example, the runtime
  132. is resuming after being idle).</li></ul></p>
  133. </apiDesc></adobeApiEventDetail></adobeApiEvent><apiConstructor id="flash.sensors:Accelerometer:Accelerometer" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation apiOperation/apiConstructor"><apiName class="- topic/title reference/title apiRef/apiName ">Accelerometer</apiName><shortdesc class="- topic/shortdesc ">
  134. Creates a new Accelerometer instance.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Flash" version="10.1" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiConstructorDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail apiOperation/apiConstructorDetail"><apiConstructorDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiConstructorDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/></apiConstructorDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  135. Creates a new Accelerometer instance.
  136. </apiDesc></apiConstructorDetail></apiConstructor><apiOperation id="flash.sensors:Accelerometer:setRequestedUpdateInterval" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">setRequestedUpdateInterval</apiName><shortdesc class="- topic/shortdesc ">
  137. The setRequestedUpdateInterval method is used to set the desired time interval
  138. for updates.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Flash" version="10.1" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The specified <codeph class="+ topic/ph pr-d/codeph ">interval</codeph> is less than zero.
  139. </apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">ArgumentError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">ArgumentError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">interval</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The requested update interval. If <codeph class="+ topic/ph pr-d/codeph ">interval</codeph> is set to 0, then the minimum supported update interval is used.
  140. </apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  141. The <codeph class="+ topic/ph pr-d/codeph ">setRequestedUpdateInterval</codeph> method is used to set the desired time interval
  142. for updates. The time interval is measured in milliseconds. The update interval is only used as a
  143. hint to conserve the battery power. The actual time between acceleration updates may be greater
  144. or lesser than this value. Any change in the update interval affects all registered listeners.
  145. You can use the Accelerometer class without calling the <codeph class="+ topic/ph pr-d/codeph ">setRequestedUpdateInterval()</codeph>
  146. method. In this case, the application receives updates based on the device's default interval.
  147. </apiDesc></apiOperationDetail></apiOperation><apiValue id="flash.sensors:Accelerometer:isSupported:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">isSupported</apiName><shortdesc class="- topic/shortdesc ">
  148. The isSupported property is set to true if the accelerometer sensor is
  149. available on the device, otherwise it is set to false.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Flash" version="10.1" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  150. The <codeph class="+ topic/ph pr-d/codeph ">isSupported</codeph> property is set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph> if the accelerometer sensor is
  151. available on the device, otherwise it is set to <codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
  152. </apiDesc><example conref="examples\Accelerometer_isSupported.as" class="- topic/example "> The following example uses the <codeph class="+ topic/ph pr-d/codeph ">Accelerometer.isSupported</codeph> property to test for Accelerometer support at runtime.
  153. If the current environment supports the Accelerometer feature, then an event listener is added to the Accelerometer object, and the associated handler
  154. populates the text field with the timestamp and acceleration values. Otherwise, the text field indicates that the feature is not supported in the current
  155. environment.
  156. <codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
  157. var myTextField:TextField = new TextField();
  158. myTextField.width = 200;
  159. addChild(myTextField);
  160. var acc1:Accelerometer = new Accelerometer();
  161. var isSupported:Boolean = Accelerometer.isSupported;
  162. checksupport();
  163. function checksupport():void {
  164. if (isSupported) {
  165. myTextField.text = "Accelerometer feature supported";
  166. acc1.addEventListener(AccelerometerEvent.UPDATE, updateHandler);
  167. } else {
  168. myTextField.text = "Accelerometer feature not supported";
  169. }
  170. }
  171. function updateHandler(evt:AccelerometerEvent):void {
  172. myTextField.text = String("at: " + evt.timestamp + "\n" + "acceleration X: " + evt.accelerationX + "\n" + "acceleration Y: " + evt.accelerationY + "\n" + "acceleration Z: " + evt.accelerationZ);
  173. }
  174. </codeblock></example></apiValueDetail></apiValue><apiValue id="flash.sensors:Accelerometer:muted:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">muted</apiName><shortdesc class="- topic/shortdesc ">
  175. Specifies whether the user has denied access to the accelerometer (true)
  176. or allowed access (false).</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Flash" version="10.1" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">Accelerometer, Accelerometer.muted, muted
  177. </keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  178. Specifies whether the user has denied access to the accelerometer (<codeph class="+ topic/ph pr-d/codeph ">true</codeph>)
  179. or allowed access (<codeph class="+ topic/ph pr-d/codeph ">false</codeph>). When this value changes,
  180. a <codeph class="+ topic/ph pr-d/codeph ">status</codeph> event is dispatched.
  181. </apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.sensors.xml#Accelerometer/event:status" class="- topic/link "><linktext class="- topic/linktext ">status</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.sensors:Geolocation" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">Geolocation</apiName><shortdesc class="- topic/shortdesc ">
  182. The Geolocation class dispatches events in response to the device's location sensor.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">flash.events:EventDispatcher</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  183. The Geolocation class dispatches events in response to the device's location sensor.
  184. <p class="- topic/p ">If a device supports geolocation, you can use this class to obtain the current geographical
  185. location of the device. The geographical location is displayed on the device in the form of latitudinal
  186. and longitudinal coordinates (in WGS-84 standard format). When the location of the device changes,
  187. you can receive updates about the changes. If the device supports this feature, you will be able to obtain
  188. information about the altitude, accuracy, heading, speed, and timestamp of the latest change in the location.</p>
  189. <p class="- topic/p "><i class="+ topic/ph hi-d/i ">AIR profile support:</i> This feature is supported
  190. only on mobile devices. It is not supported on desktop or AIR for TV devices. You can test
  191. for support at run time using the <codeph class="+ topic/ph pr-d/codeph ">Geolocation.isSupported</codeph> property. See
  192. <xref href="http://help.adobe.com/en_US/air/build/WS144092a96ffef7cc16ddeea2126bb46b82f-8000.html" class="- topic/xref ">
  193. AIR Profile Support</xref> for more information regarding API support across multiple profiles.
  194. </p>
  195. </apiDesc><example conref="examples\GeolocationExample.as" class="- topic/example "> In the following example, the application displays the latitude,
  196. longitude, and horizontal accuracy of geolocation <codeph class="+ topic/ph pr-d/codeph ">update</codeph> events
  197. as they are received.
  198. <codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
  199. package
  200. {
  201. import flash.display.Sprite;
  202. import flash.display.StageAlign;
  203. import flash.display.StageScaleMode;
  204. import flash.events.GeolocationEvent;
  205. import flash.sensors.Geolocation;
  206. import flash.text.TextField;
  207. import flash.text.TextFormat;
  208. public class GeolocationTest extends Sprite
  209. {
  210. private var geo:Geolocation;
  211. private var log:TextField;
  212. public function GeolocationTest()
  213. {
  214. stage.scaleMode = StageScaleMode.NO_SCALE;
  215. stage.align = StageAlign.TOP_LEFT;
  216. setUpTextField();
  217. if (Geolocation.isSupported)
  218. {
  219. geo = new Geolocation();
  220. geo.setRequestedUpdateInterval(100);
  221. geo.addEventListener(GeolocationEvent.UPDATE, geolocationUpdateHandler);
  222. }
  223. else
  224. {
  225. log.text = "No geolocation support.";
  226. }
  227. }
  228. private function geolocationUpdateHandler(event:GeolocationEvent):void
  229. {
  230. log.text = "latitude:" + event.latitude.toString() + "°\n";
  231. log.appendText("longitude:" + event.longitude.toString() + "°\n");
  232. log.appendText("horizontal accuracy:" + event.horizontalAccuracy.toString() + " m");
  233. }
  234. private function setUpTextField():void
  235. {
  236. log = new TextField();
  237. var format:TextFormat = new TextFormat("_sans", 24);
  238. log.defaultTextFormat = format;
  239. log.border = true;
  240. log.wordWrap = true;
  241. log.multiline = true;
  242. log.x = 10;
  243. log.y = 10;
  244. log.height = stage.stageHeight - 20;
  245. log.width = stage.stageWidth - 20;
  246. addChild(log);
  247. }
  248. }
  249. }
  250. </codeblock></example></apiClassifierDetail><related-links class="- topic/related-links "><link href="http://coenraets.org/blog/2010/08/multi-user-google-map-collaboration-on-android/" class="- topic/link "><linktext class="- topic/linktext ">Cristophe Coenraets: Mulit-user Google Maps Collaboration</linktext></link></related-links><adobeApiEvent id="flash.sensors:Geolocation_flash.events.StatusEvent.STATUS_status" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef adobeApiEvent/adobeApiEvent "><apiName class="- topic/title reference/title apiRef/apiName ">status</apiName><shortdesc class="- topic/shortdesc ">
  251. The Geolocation object dispatches status events when the user changes access
  252. to the location sensor.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><adobeApiEventDetail class="- topic/body reference/refbody apiRef/apiDetail adobeApiEvent/adobeApiEventDetail "><adobeApiEventDef class="- topic/section reference/section apiRef/apiDef adobeApiEvent/adobeApiEventDef "><apiEventType class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiEventType ">flash.events.StatusEvent.STATUS</apiEventType><adobeApiEventClassifier class="- topic/xref reference/xref apiRef/apiRelation adobeApiEvent/adobeApiEventClassifier ">flash.events.StatusEvent</adobeApiEventClassifier><apiGeneratedEvent class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiGeneratedEvent "/></adobeApiEventDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  253. The Geolocation object dispatches <codeph class="+ topic/ph pr-d/codeph ">status</codeph> events when the user changes access
  254. to the location sensor. For example, if, in response to a device prompt, the user prevents the
  255. application from accessing location data, the Geolcation object dispatches a <codeph class="+ topic/ph pr-d/codeph ">status</codeph>
  256. event. When the status changes to a state where the location sensor is not available, the
  257. <codeph class="+ topic/ph pr-d/codeph ">muted</codeph> property of the Geolocation instance is <codeph class="+ topic/ph pr-d/codeph ">true</codeph>.
  258. </apiDesc></adobeApiEventDetail><related-links class="- topic/related-links "><link href="flash.sensors.xml#Geolocation/muted" class="- topic/link "><linktext class="- topic/linktext ">muted</linktext></link></related-links></adobeApiEvent><adobeApiEvent id="flash.sensors:Geolocation_flash.events.GeolocationEvent.UPDATE_update" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef adobeApiEvent/adobeApiEvent "><apiName class="- topic/title reference/title apiRef/apiName ">update</apiName><shortdesc class="- topic/shortdesc ">
  259. The update event is dispatched in response to updates from the location sensor.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><adobeApiEventDetail class="- topic/body reference/refbody apiRef/apiDetail adobeApiEvent/adobeApiEventDetail "><adobeApiEventDef class="- topic/section reference/section apiRef/apiDef adobeApiEvent/adobeApiEventDef "><apiEventType class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiEventType ">flash.events.GeolocationEvent.UPDATE</apiEventType><adobeApiEventClassifier class="- topic/xref reference/xref apiRef/apiRelation adobeApiEvent/adobeApiEventClassifier ">flash.events.GeolocationEvent</adobeApiEventClassifier><apiGeneratedEvent class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiGeneratedEvent "/></adobeApiEventDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  260. The <codeph class="+ topic/ph pr-d/codeph ">update</codeph> event is dispatched in response to updates from the location sensor. The event
  261. is dispatched under the following circumstances:
  262. <p class="- topic/p "><ul class="- topic/ul "><li class="- topic/li ">When a new listener function is attached through <codeph class="+ topic/ph pr-d/codeph ">addEventListener()</codeph>, this event is
  263. delivered once to all the registered listeners to provide the current value of the location.</li><li class="- topic/li ">Whenever location updates are obtained from the platform at device determined intervals.</li><li class="- topic/li ">Whenever the application misses a change in the location (for example, the application is waking up
  264. after being asleep).</li></ul></p>
  265. <p class="- topic/p "><i class="+ topic/ph hi-d/i ">Note:</i> First-generation iPhones, which do not include a GPS unit, dispatch
  266. <codeph class="+ topic/ph pr-d/codeph ">update</codeph> events only occasionally. On these devices, a Geolocation object initially
  267. dispatches one or two <codeph class="+ topic/ph pr-d/codeph ">update</codeph> events. It then dispatches <codeph class="+ topic/ph pr-d/codeph ">update</codeph> events
  268. when information changes noticeably.</p>
  269. </apiDesc></adobeApiEventDetail></adobeApiEvent><apiConstructor id="flash.sensors:Geolocation:Geolocation" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation apiOperation/apiConstructor"><apiName class="- topic/title reference/title apiRef/apiName ">Geolocation</apiName><shortdesc class="- topic/shortdesc ">
  270. Creates a new Geolocation instance.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiConstructorDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail apiOperation/apiConstructorDetail"><apiConstructorDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiConstructorDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/></apiConstructorDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  271. Creates a new Geolocation instance.
  272. </apiDesc></apiConstructorDetail></apiConstructor><apiOperation id="flash.sensors:Geolocation:setRequestedUpdateInterval" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">setRequestedUpdateInterval</apiName><shortdesc class="- topic/shortdesc ">
  273. Used to set the time interval for updates, in milliseconds.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The specified <codeph class="+ topic/ph pr-d/codeph ">interval</codeph> is less than zero.
  274. </apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">ArgumentError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">ArgumentError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">interval</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">requested update interval. If <codeph class="+ topic/ph pr-d/codeph ">interval</codeph> &lt;= 0, then any call to this method
  275. has no effect.
  276. </apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  277. Used to set the time interval for updates, in milliseconds. The update interval is only used as a
  278. hint to conserve the battery power. The actual time between location updates may be greater or
  279. lesser than this value.Any change in the update interval using this method
  280. affects all registered <codeph class="+ topic/ph pr-d/codeph ">update</codeph> event listeners. The Geolocation class
  281. can be used without calling the <codeph class="+ topic/ph pr-d/codeph ">setRequestedUpdateInterval</codeph> method.
  282. In this case, the platform will return updates based on its default interval.
  283. <p class="- topic/p "><i class="+ topic/ph hi-d/i ">Note:</i> First-generation iPhones, which do not include a GPS unit, dispatch
  284. <codeph class="+ topic/ph pr-d/codeph ">update</codeph> events only occasionally. On these devices, a Geolocation object initially
  285. dispatches one or two <codeph class="+ topic/ph pr-d/codeph ">update</codeph> events. It then dispatches <codeph class="+ topic/ph pr-d/codeph ">update</codeph> events
  286. when information changes noticeably.</p>
  287. </apiDesc></apiOperationDetail></apiOperation><apiValue id="flash.sensors:Geolocation:isSupported:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">isSupported</apiName><shortdesc class="- topic/shortdesc ">
  288. Whether a location sensor is available on the device (true); otherwise false.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  289. Whether a location sensor is available on the device (<codeph class="+ topic/ph pr-d/codeph ">true</codeph>); otherwise <codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
  290. </apiDesc></apiValueDetail></apiValue><apiValue id="flash.sensors:Geolocation:muted:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">muted</apiName><shortdesc class="- topic/shortdesc ">
  291. Specifies whether the user has denied access to the geolocation (true)
  292. or allowed access (false).</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="AIR" version="2" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">Geolocation, Geolocation.muted, muted
  293. </keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
  294. Specifies whether the user has denied access to the geolocation (<codeph class="+ topic/ph pr-d/codeph ">true</codeph>)
  295. or allowed access (<codeph class="+ topic/ph pr-d/codeph ">false</codeph>). When this value changes,
  296. a <codeph class="+ topic/ph pr-d/codeph ">status</codeph> event is dispatched.
  297. </apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.sensors.xml#Geolocation/event:status" class="- topic/link "><linktext class="- topic/linktext ">status</linktext></link></related-links></apiValue></apiClassifier></apiPackage>