I have a map which I've populated with custom markers controlled with
MarkerManager so the markers can appear at different zoom levels.  The
marker data is obtained from a MySQL table,  (via a JSON object).

Each marker should have an infoWindow, but whatever marker I click the
infoWindow always comes up in the same place (attached to the last
marker generated). I suspect the problem is that I haven't created a
'closure', but I can't yet see how to do this in the context.

Link: http://www.holidaymullandiona.com/maps5/

I suspect the problem lies in this snippet from
'map_functions.js' (line 220):

        function setupMullMarkers() {
                if (typeof(moremarkers) !== 'undefined') {
                        markerLayer.push(moremarkers);
                }
                allmarkers.length = 0;
                for (var i in markerLayer) {
                        var layer = markerLayer[i];
                        var markers = [];
                        for (var j in layer["places"]) {
                                var place = layer["places"][j];
                                var icon = getIcon(place["icon"]);
                                // place[icon] points to an icon in mullMarkers 
var iconData
(=images in getIcon())
                                var title = place["name"];
                                var bus_class = place["bus_class"];
                                var posn = new GLatLng(place["posn"][0], 
place["posn"][1]);

                                if (place["desc"]) {
                                        var desc = place["desc"];
                                }else {
                                        var desc = place["name"];
                                }
                                var marker = new GMarker (posn, {title: title, 
icon: icon, desc:
desc, draggable: false});
                                GEvent.addListener (marker, 'click',
                                        function() {
                                                marker.openInfoWindowHtml(desc);
                                        }
                                );
                                markers.push(marker);
                                allmarkers.push(marker);
                        }
                        mgr.addMarkers(markers, layer["zoom"][0], 
layer["zoom"][1]);
                }
                mgr.refresh();
        }

It seems the listener must be getting added to each marker, but for
some reason not the latLong co-ordinates.  Any suggestions, please ?
Tim Dawson

-- 
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.

Reply via email to