Ross and Ralph, Thank you both for the replies!
Yes, I changed it to declare an empty array as var markersfoo = []; and the error disapperaed :-) Turning one stone will only make you find another one...why in all name is it complaining about var markerCluster not beinf defined? I have tried to delclare it as var markerCluster; and var markerCluster=[]; but with the same annoying result. And Ross...I move out the markerCluster from the loop...thanks. Good point! Why is not markerCluster defined? /Nimrod On 14 Maj, 21:51, Rossko <[email protected]> wrote: > > Hmmm...changed the names but no luck...any other possibilities? > > Do you not read the javascript errors? just now it says 'markersfoo > has no properties' and points at this line - > markersfoo.push(markerOnMap); > > So, lets look at whats wrong with that. > Earlier on we have - > var markersfoo; > which defines it as a plain ordinary one-dimensional variable. When > we try to do a .push() on it later, it fails because markersfoo is not > an array. > Replace your 'empty variable' creation with > var markersfoo = []; > which will make an 'empty array' instead, which will accept .push() > actions. > > While we're changing things, look at ... > for (var i = 0; i < markersXml.length; ++i) { > .... > markersfoo.push(markerOnMap); > markerCluster = new MarkerClusterer(map, markersfoo); > } > This will push each new marker onto the array, and give the array to > the clusterer ... every time around the loop, with the array getting > one longer each time and including the previous markers already added. > > This - > for (var i = 0; i < markersXml.length; ++i) { > .... > markersfoo.push(markerOnMap); > } > markerCluster = new MarkerClusterer(map, markersfoo); > would push each marker onto the array until the loop is finished, and > then give the completed array to clusterer just once. > > cheers, Ross K --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
