/*Getting the Compiler Error:- 1120: Access of undefined property
address. What have I done wrong? Any ideas? The code is in the
timeframe where the Google Maps component is on the stage*/
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapMouseEvent;
import com.google.maps.MapType;
import com.google.maps.services.GeocodingEvent;
import com.google.maps.services.ClientGeocoder;
import com.google.maps.overlays.Marker;
import com.google.maps.InfoWindowOptions;
import com.google.maps.wrappers.IClientGeocoderWrapper;
var map:Map = new Map();
map.key
=
"ABQIAAAAYqCVuQqB6p3lRPozL5jdzxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxS2Lqix7Q_sWg0c8SlvhUCudQ1C_w";
map.sensor = "false";
map.setSize(new Point(stage.stageWidth, stage.stageHeight));
this.addChild(map);
function doGeocode(event:GeocodingEvent):void {
var geocoder:ClientGeocoder = new ClientGeocoder();
geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS,
function(event:GeocodingEvent):void {
var placemarks:Array = event.response.placemarks;
if (placemarks.length > 0) {
map.setCenter(placemarks[0].point);
var marker:Marker = new Marker(placemarks[0].point);
map.addOverlay(marker);
marker.addEventListener(MapMouseEvent.CLICK,
function(event:MapEvent):void {
marker.openInfoWindow(new InfoWindowOptions({
title: "Geocoded Result",
content: placemarks[0].address
}));
});
}
});
geocoder.addEventListener(GeocodingEvent.GEOCODING_FAILURE,
function(event:GeocodingEvent):void {
trace("Geocoding failed");
});
geocoder.geocode(address.text);
}
--
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.