hey, thanks for the replies, yes i've written a trace() into the following if statement:
protected function myMap_loadHandler(event:MapEvent):void
{
if (Geolocation.isSupported)
{trace("geo loop begin");
geo = new Geolocation;
if (!geo.muted) // check if Geolocation is not disabled on the device
{trace("geo on");
zoomToCurrentLocationImg.source = m_gpsA;
zoomToCurrentLocationImg.visible = true;
}
}
}
i get the "geo loop begin" trace but not the "geo on", i've checked the device settings and geolocation works fine in all other apps.
any ideas?! do others have this working?
thanks
Ben
private function locate():void { if (Geolocation.isSupported==true) { //Initialize the location sensor. geolocation = new Geolocation(); geolocation.setRequestedUpdateInterval(5000); geolocation.addEventListener(GeolocationEvent.UPDATE, onTravel); } else { Alert.show("Geolocation feature not supported"); } } //geolocation event listener private function onTravel(event:GeolocationEvent):void { var long:String = event.longitude.toString(); var lat:String = event.latitude.toString(); var longnew:Number = Number(long); var latnew:Number = Number(lat); var GPSPoint:MapPoint = new MapPoint(longnew, latnew); GPSPoint.spatialReference = new SpatialReference(4326); var outSR:SpatialReference = new SpatialReference(2234); geometryService.project([GPSPoint as Geometry], outSR); }
private function bufferGPS():void { var bufferParameters:BufferParameters = new BufferParameters(); bufferParameters.geometries = [ map point to buffer ]; bufferParameters.distances = [this will be where you put the accuracy number]; // Note: As of version 2.0, the buffer constants have been moved to GeometryService. bufferParameters.unit = GeometryService.UNIT_METER; bufferParameters.bufferSpatialReference = map.spatialReference; bufferParameters.outSpatialReference = map.spatialReference; geometryService1.addEventListener(GeometryServiceEvent.BUFFER_COMPLETE, bufferCompleteHandler); geometryService1.buffer(bufferParameters); function bufferCompleteHandler(event:GeometryServiceEvent):void { geometryService1.removeEventListener(GeometryServiceEvent.BUFFER_COMPLETE, bufferCompleteHandler); // Note: As of version 2.0, GeometryService returns geometries (instead of graphics) for each (var geometry:Polygon in event.result) { var graphic:Graphic = new Graphic(); graphic.geometry = geometry; graphic.symbol = fillSymbol; myGraphicsLayer.add(graphic); } }