My idea is that everytime I click on an item in a datagrid, a new kml
file will be loaded and the polygon in it will be mapped using the KML
demo. I need some pointers to remove the polygon before a new one is
being added. I've tried the map.remove(polygon) from following but it
it doesn't work. What would you do? Thanks.

else if (geometry is KmlPolygon) {

var kmlPolygon:KmlPolygon = KmlPolygon(geometry);

var options:PolygonOptions = new PolygonOptions();

map.removeOverlay(polygon);

if (styleUrl) {

styleUrl = styleUrl.replace("#", "");

if (kmlStyles[styleUrl]) {

var style:Style = kmlStyles[styleUrl];

options.fillStyle = new FillStyle();

options.fillStyle.color = style.polyStyle.color;

options.strokeStyle = new StrokeStyle();

options.strokeStyle.thickness = style.lineStyle.width;

}

}

polygon = new
Polygon(getCoordinatesLatLngs(kmlPolygon.outerBoundaryIs.linearRing.coordinates),
options);

obj.mapObjs.push(polygon);

updateBounds(obj, polygon.getLatLngBounds());

map.addOverlay(polygon);

-- 
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.

Reply via email to