The while loop is working fine to make the MVCArray empty. Thanks for that.
I'll try your test case a bit later. Looks good. Thanks. On Jun 15, 7:39 pm, Chad Killingsworth <[email protected]> wrote: > This is where I add the standard text, "Can you provide a link to your > site?" > > Here's the test case I ran which worked: > > var points = new google.maps.MVCArray([ > new google.maps.LatLng(37.20084, -93.28121), > new google.maps.LatLng(37.201, -93.292), > new google.maps.LatLng(37.194, -93.293), > new google.maps.LatLng(37.195, -93.279) > ]); > var line = new google.maps.Polyline({map: map, path: points}); > var shape = new google.maps.Polygon({map: map, path: points}); > points.pop(); > > The last line immediately changed both the polyline and the polygon on > the map. > > Chad Killingsworth > > On Jun 15, 12:25 pm, Pil <[email protected]> wrote: > > > When I access a normal array with the method of an MVCArray I get an > > error > > > Error: points.removeAt is not a function > > > But it seems I cannot force the polyline to use my own provided > > MVCArray. > > The creating of a polyline/polygon seems to include the creation of an > > implied MVCArray. So there seems no possibility that a polyline and a > > polygon can share the same MVCArray alternately. > > > On Jun 15, 6:41 pm, Nathan Raley <[email protected]> wrote: > > > > Err sorry, I edited my text and forgot to clear out a line. > > > > Ignore the line "This clears out the position "pointer" in the array > > > points." > > > > The rest should be valid for you. Let me know if that helps you out. > > > > On Tue, Jun 15, 2010 at 11:40 AM, Nathan Raley <[email protected]> > > > wrote: > > > > Well if you are wanting to set clear the entire array you should do: > > > > points = []; > > > > > This clears out the position "pointer" in the array points. > > > > > If you want to remove only the last position you do it as: > > > > points.pop(); > > > > > If you want to remove a specific element at a specific location you do: > > > > points.removeAt(i); > > > > Where i is the position you want cleared out. > > > > > This help any? > > > > > On Tue, Jun 15, 2010 at 11:29 AM, Pil <[email protected]> wrote: > > > > >> On Jun 15, 6:05 pm, Nathan Raley <[email protected]> wrote: > > > >> > Did you try points = [];? > > > > >> Yes, this doesn't work when I say > > > > >> poly.setPath(points); > > > > >> i.e. no polyline will appear. When I use a MVCArray all works well. > > > >> The MVCArray should be shared alternately between a Polyline and a > > > >> Polygon. This all works well - but I found no way to set the elements > > > >> of the MVCArray to 0. > > > > >> -- > > > >> 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]<google-maps-js-api-v3%2B > > > >> [email protected]> > > > >> . > > > >> For more options, visit this group at > > > >>http://groups.google.com/group/google-maps-js-api-v3?hl=en. -- 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.
