views:

21

answers:

1

I'm sorry if I'm asking a basic question, but I can't find it anywhere and I don't understand too much from the provided documentation. Basically, I want to make a *.SWF in which the user inserts an address in the first frame, then in the second frame Google Maps shows that place. The problem is that I don't know how to zoom on a point without LatLng parameter. Probably, Geocoding would be the solution, but as I said earlier, I don't understand how it works in Flash. Could someone please either post a few lines or direct me to an example of geocoding in Flash? Thank you very much.

A: 

You would use a com.google.maps.services.ClientGeocoder for that.

Here are some code fragments, not complete code, but it may give you something to start with:

import com.google.maps.services.ClientGeocoder;
import com.google.maps.services.GeocodingEvent;

var geocoder:ClientGeocoder = new ClientGeocoder();

geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS, onGeocodeDone);
geocoder.addEventListener(GeocodingEvent.GEOCODING_FAILURE, onGeocodeFault);

geocoder.geocode("The address goes here");

function onGeocodeDone(e:GeocodingEvent):void
{
   trace("lat: " + e.response.placemarks[0].point.lat());
   trace("lng: " + e.response.placemarks[0].point.lng());
}

function onGeocodeFault(e:GeocodingEvent):void
{
   trace("Geocoding failed: " + e.status);
}
Lars
Thank you very much, I'm going to give it a try. Really appreciate it :).
bboylalu