Do you have declared markersArray as global variable? And instead of markersArray.lentgh = 0 use markerArray = [] to initialize the array again
Bye 2010/8/5 [email protected] <[email protected]> > On Aug 5, 5:00 am, morningstar <[email protected]> wrote: > > I'm working on a small map app and when i try to remove markers on the > > map that i had placed earlier, with the following function; > > > > function clearLocations() { > > for (i in markersArray) { > > markersArray[i].setMap(null); > > } > > markersArray.length = 0; > > } > > > > I get the error markersArray[i].setMap is not a function and the > > markers are still on the map.Help will be appreciated. > > > More context please. Preferably a link to your map that exhibits the > error. The most likely cause of your problem is that the markersArray > is not in scope. > > -- Larry > > > Thanks > > -- > 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%[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.
