Hi. Was hoping for some simple coding assistance.
I have a main.mxml file which is a basic UI that lets the user enter an
address and then places a marker at that address. Pretty basic.
To do the geocoding I created a class called GeoSite. In main.mxml everytime
the user enters an address and clicks "Enter" button an object of type
GeoSite is instantiated and passed the address. Then the geocoding_SUCCESS
event handler converts the address to LatLng. Then a marker is passed the
LatLng. But I can't figure out how to add the marker to the 'map' in the
main.mxml.
If that makes sense suggestions would be awesome. Thanx in advance.
package asClasses
{
public class GeoSite
{
import com.google.maps.LatLng;
import com.google.maps.MapType;
import com.google.maps.overlays.Marker;
import com.google.maps.services.ClientGeocoder;
import com.google.maps.services.GeocodingEvent;
import com.google.maps.MapMouseEvent;
import com.google.maps.MapEvent;
private var geoObject:ClientGeocoder = new ClientGeocoder;
private var coords:LatLng;
private var markerA:Marker;
public function GeoSite(address:String)
{
geoObject.geocode(address);
geoObject.addEventListener(GeocodingEvent.GEOCODING_FAILURE, geoFailure);
geoObject.addEventListener(GeocodingEvent.GEOCODING_SUCCESS, geoSuccess);
}
private function geoFailure(e:GeocodingEvent):void{
trace('failed');
}
private function geoSuccess(e:GeocodingEvent):void{
var result:Array = e.response.placemarks;
var coords:LatLng;
coords = result[0].point;
markerA = new Marker(coords);
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---