Last active
December 17, 2015 22:29
-
-
Save marchbold/5682277 to your computer and use it in GitHub Desktop.
This is a simple example of using the compass ANE from distriqt to get compass heading updates.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* __ __ __ | |
* ____/ /_ ____/ /______ _ ___ / /_ | |
* / __ / / ___/ __/ ___/ / __ `/ __/ | |
* / /_/ / (__ ) / / / / / /_/ / / | |
* \__,_/_/____/_/ /_/ /_/\__, /_/ | |
* / / | |
* \/ | |
* http://distriqt.com | |
* ------------------------------------- | |
* | |
* brief: Compass ANE example for initialisation, and basic usage. | |
* tag: distriqt.extension.compass | |
* | |
*/ | |
package | |
{ | |
public class CompassExample extends Sprite | |
{ | |
public static const DEVELOPER_KEY : String = "your-dev-key"; | |
public function CompassExample() | |
{ | |
Compass.init( DEVELOPER_KEY ); | |
if (Compass.isSupported()) | |
{ | |
Compass.service.addEventListener( CompassEvent.HEADING_UPDATED, headingHandler, false, 0, true ); | |
Compass.service.register(); | |
} | |
} | |
private function headingHandler( event:CompassEvent ):void | |
{ | |
trace( event.type +":"+ event.magneticHeading+":"+ event.trueHeading+":"+ event.headingAccuracy ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment