> I just read briefly about function closures and I think I have an idea > of what is going on. If I create a function outside of the outer > function(addMarkers) is there any way to know which marker was clicked > on?
Read some more and have a play with code. Taking code out to another function and passing arguments to it is indeed the key to achieving closure. The clever part of closure, is that it will "capture" passed- in data at the time that you create the event listener for each marker ; when a listener is actually triggered, that data will be available by the magic of closure. Could be a marker object or whatever else you want. -- 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.
