Skip to content

DaVikingCode/Altimeter-ANE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Altimeter-ANE

iOS ANE for the CMAltimeter class.

Instructions

Add those lines to your *-app.xml file:

<extensions>
	<extensionID>com.davikingcode.nativeExtensions.Altimeter</extensionID>
</extensions>

Usage:

import com.davikingcode.nativeExtensions.altimeter.Altimeter;
import com.davikingcode.nativeExtensions.altimeter.AltimeterEvent;

import flash.utils.setTimeout;

var altimeter:Altimeter = new Altimeter();

if (altimeter.isAvailable()) {

	altimeter.addEventListener(AltimeterEvent.AltitudeData, altimeterEvent);
	altimeter.addEventListener(AltimeterEvent.AltitudeError, altimeterEvent);
	
	altimeter.start();
	
	setTimeout(function():void {
		
		altimeter.stop();
		
	}, 10000);
}

function altimeterEvent(aEvt:AltimeterEvent):void {
			
	trace(aEvt.type, aEvt.informations);

	var data:Object = JSON.parse(aEvt.informations);
	trace(data.pressure);
	trace(data.relativeAltitude);
}

This ANE open source version has been sponsored by Paracam.