On Jan 19, 6:20 am, Alphawolf <[email protected]> wrote:
> Hey there,
>
> I'm trying to toggle the visibility of a set of Polygones. Basically I
> create the Polygones and add them to an array like:
>
> polygon1 = new google.maps.Polygon({ ... });
> polygon2 = new google.maps.Polygon({ ... });
> polyArr.push(polygon1);
> polyArr.push(polygon2);
>
> I'm trying to access each Polygon of the polyArr by looping through
> it:
>
> function togglePolygones() {
>         for (var i = 0; i < polyArr.length; i++) {
>                 if(polyArr[i].getMap()) {
>                         polyArr[i].setMap(null);
>                 } else {
>                         polyArr[i].setMap(map);
>                 }
>         }
>
> }
>
> It hides all Polygones corrently, but doesn't render them after
> another click.
>
> Anyone?

Link to your map that shows the problem?
http://groups.google.com/group/google-maps-js-api-v3/t/2b3f101fd509919e

I have lots of examples that do that.
Most of the public ones are using geoxml3 (here is one):
http://www.geocodezip.com/geoxml3_test/geoxml3_test_polygon.html

  -- Larry

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to