Glad you got it working maintaining the "this" reference. Perhaps it's still in scope because of closures?? Perhaps someone can clarify?
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Jonny Sent: Thursday, April 23, 2009 2:22 PM To: Google Maps API Subject: Re: removeOverlay(marker) + creating variable name on the fly for each marker Thanks very much for your comments. I managed to get it working before you replied doing the following although I'm still using 'this': if(calculateHaversineDistance(...) <= 1){ //1mile radius if(this["store" + i] == null){ this["store" + i] = new GMarker(point2, {icon:icon}); map.addOverlay(this["store" + i]); popup(this["store" + i], image, markers[i].getAttribute ("latitude"), markers[i].getAttribute("longitude")); } } else { if(this["store" + i] != null){ map.removeOverlay(this["store" + i]); this["store" + i] = null; } } I tried changing all the "this"es to "markerArray" but it didn't work but that might be because I don't know how to call the value once I've assigned it? markerArray.store[i]? Ok I will think about using something different like a store_id although at the moment I am just doing an MSc project of a proof of concept so I only need to demonstrate my idea. With regards to hide/show I got it to work sort of but it was extremely slow and took a long time to decide which markers to hide/ show. Regards. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
