Harry,
I think you will find all the code you need, along with some explanation in
chapters 5 and 6 (if you want on-the-fly style creation) at
http://tnatlas2.geog.utk.edu/TutorHome.  Click on the chapters tab to find
the ones you need.

Bruce

On Fri, Nov 5, 2010 at 11:42 PM, Harry Lai <[email protected]> wrote:

> 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]<google-maps-api-for-flash%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api-for-flash?hl=en.
>



-- 
Bruce Ralston
Professor
Department of Geography
University of Tennessee
Knoxville, TN 37996-0925
Phone: 865-974-6043
FAX: 865-974-6025

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