I am pretty new to the API, so please forgive me if I'm missing
something obvious.

I can create a simple rectangle using Mike Williams EShapes.js.  It's
great!  However, I would like to destroy the rectangle on command as
well.  Here's what I'm trying:

                        var showrec = 0;

                        function showrectangle() {
                                if( showrec==0 ) {
                                        var point1 = new 
GLatLng(startlat,startlon);
                                        var rectangle1 =
map.addOverlay(GPolygon.Shape(point1,1609.334*5,1609.334*10,1609.334*5,1609.334*10,0,4,"#000000",
3,.5,"#ffffff",.5,{},true));
                                        showrec = 1;
                                }
                                else {
                                        map.removeOverlay(rectangle1);
                                        showrec = 0
                                }
                        }


And then I have a button that calls showrectangle() when clicked.  It
works great when I click the first time, but the second click returns
the following error:

Error: a is undefined
Source File: http://maps.google.com/intl/en_us/mapfiles/128e/maps2.api/main.js
Line: 619

If I change the removeOverlay argument from rectangle1 to something
nonexistent it returns a different error.

What am I missing here?

Thanks in advance!

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