Package | ardisia.components.htmlGeolocation |
Class | public class HtmlGeolocation |
Inheritance | HtmlGeolocation flash.events.EventDispatcher |
This component will NOT work within the AIR environment. For HTML support in AIR, try the native mx.controls.HTML and flash.html.HTMLLoader classes.
Only works if the browser supports HTML5 geolocation and ExternalInterface.
To use: initialize this class in the declarations tag or in actionscript, attach an UPDATE and ERROR listener and call getCurrentPosition(). Since the location data is returned asynchronously, an event handler is required to get the location data instead of directly returning the position information by the getCurrentPosition function.
View the technical documentation on the Ardisia Labs website for more information.
Design Notes:
Property | Defined By | ||
---|---|---|---|
isSupported : Boolean [read-only]
Return whether the ExternalInterface supports the HTML5 geolocation api. | HtmlGeolocation |
Method | Defined By | ||
---|---|---|---|
HtmlGeolocation | |||
getCurrentPosition():void
Get the current geolocation position via the HTML5 Geolocation API. | HtmlGeolocation |
Method | Defined By | ||
---|---|---|---|
addEmbeddedReference():void
Adds the code necessary to locate the swf in the html DOM. | HtmlGeolocation | ||
geoLocationError(error:Object):void
Called by the browser after getCurrentPosition() fails and returns
an error. | HtmlGeolocation | ||
geoLocationPositionResults(position:Object):void
Called by the browser after getCurrentPosition() successfully returns
positioning data. | HtmlGeolocation | ||
isTestId(testString:String):Boolean
Tests whether the passed string is the test string. | HtmlGeolocation |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when the ExternalInterface returns an error after a call to getCurrentPosition(). | HtmlGeolocation | |||
Dispatched when the ExternalInterface returns position data after a call to getCurrentPosition(). | HtmlGeolocation |
isSupported | property |
isSupported:Boolean
[read-only] Return whether the ExternalInterface supports the HTML5 geolocation api.
The default value is undefined
.
public function get isSupported():Boolean
HtmlGeolocation | () | Constructor |
public function HtmlGeolocation()
addEmbeddedReference | () | method |
protected function addEmbeddedReference():void
Adds the code necessary to locate the swf in the html DOM.
geoLocationError | () | method |
protected function geoLocationError(error:Object):void
Called by the browser after getCurrentPosition() fails and returns an error.
Dispatches the GeolocationErrorEvent event.
Parameters
error:Object — the error Object returned by html
|
geoLocationPositionResults | () | method |
protected function geoLocationPositionResults(position:Object):void
Called by the browser after getCurrentPosition() successfully returns positioning data.
Dispatches the HtmlGeolocationEvent.UPDATE event with the position data attached. Returns the same data as the flash GeolocationEvent for mobile devices.
Parameters
position:Object — Object the geo data returned by the browser
|
getCurrentPosition | () | method |
public function getCurrentPosition():void
Get the current geolocation position via the HTML5 Geolocation API.
isTestId | () | method |
protected function isTestId(testString:String):Boolean
Tests whether the passed string is the test string.
Parameters
testString:String |
Boolean — true on success
|
error | Event |
ardisia.components.htmlGeolocation.events.HtmlGeolocationErrorEvent
ardisiaFlexElements.components.geolocation.events.GeolocationErrorEvent
Dispatched when the ExternalInterface returns an error after a call to getCurrentPosition().
update | Event |
ardisia.components.htmlGeolocation.events.HtmlGeolocationEvent
ardisiaFlexElements.components.geolocation.events.GeolocationDesktopEvent
Dispatched when the ExternalInterface returns position data after a call to getCurrentPosition().