I just stucked with Google Maps Reverse Geocoding API (http://code.google.com/intl/hu-HU/apis/maps/documentation/geocoding/#ReverseGeocoding)
I have geolocation in lat and lon coordinates, and want to request some address detail to the location, thats why I want to use Google Maps API.
My code is the following:
public function getaddress(lat:Number,lon:Number):void{
//Google Maps reverse geocode
var getVars:URLVariables = new URLVariables();
getVars.q = lat+","+lon;
getVars.output = "xml";
getVars.sensor = "false"
getVars.key=googleMapsAPIKey
var uloader:URLLoader=new URLLoader()
uloader.addEventListener(Event.COMPLETE,gapicomplete)
uloader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS,statushandler)
var apireq:URLRequest=new URLRequest("http://maps.google.com/maps/geo")
apireq.data = getVars;
uloader.load(apireq)
}
In the response I get the following XML:
<kml xmlns="http://earth.google.com/kml/2.0"><Response>
<name></name>
<Status>
<code>610</code>
<request>geocode</request>
</Status>
</Response></kml>
The 610 error means bad API key.
The strange thing that, if I write the request simply in a browser (using the same API key) I get normal response with data.
I use Flash CS4 and AIR. Any advice? Thanks in advance!