On Feb 23, 8:08 am, penelop <[email protected]> wrote:
> Hi,
> I've created a map that allow user to click on the map and draw a
> polyline or polygon.
> I placed a button to help user undo the last click and draw the
> polygon again, but removeOverlay doesn't work properly, the old
> polygon still remains on the map.

> function PolygonManager(gmap,options) {
>         var map = gmap;
>         var gPolygon = null; //store reference to the GPolygon
>             if (gPolygon) {
>                 map.removeOverlay(gPolygon);
>             }

gPolygon is a LOCAL reference to the polygon, so it only exists while
the PolygonManager function is being executed. At the end of each run
of the function, the reference is destroyed. If you need to pass
references between function executions, the reference needs to be in a
global variable.

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to