Hi Rossko - thanks for chiming in. Getting at the XML data hasn't been
a problem, because I've been able to create markers from it (if that'
what you mean, I'm not 100% sure by the link you sent). So, yes, my
GMarker creation and listener adding code is already in the same
function as the one as one which draws from the XML source:

function retrieveMarkers {
 if request.ready state ==4 etc etc {
get xml info (it does)
if latitude and longitude are returned {
create marker
create listeners
}}}

Then again...

I tried to alter my code, changing var marker = new GMarker(latlng,
markerOptions); to this:
        var marker = createMarker(latlng);
        map.addOverlay(marker);
...and now the markers don't appear at all. I've left the 'old' line
of code as a comment so you can see what was there before. I'm not
really sure that moving everything to a separate function when all the
variables are already declared in the first function is really going
to help. Would declaring the variable 'marker' outside of the function
help? I doubt it, but I thought I'd put it out there. 
www.studio401.ca/index2.php

Yes, I've been going through 'view source' in Mike's tutorial. It
might address my problem, but in a circumspect way. I think the
versions of the API are the same, too ('2x' or somesuch).

Help! :)


On Apr 27, 3:51 pm, Rossko <[email protected]> wrote:
> > ...causes a failure in creating the markers. What I need is a way of
> > making sure the addListener refers to each marker not just the last
> > one. How do I do that? Ideas, anyone?
>
> Go back to Mike's tutorial.   Use your browser 'view source' in the
> given example, perhaps you missed the link in "Here's a simple
> example".   It's not that the API commands used are any different, it
> is the way it is structured in a function that makes it work.
> Move your GMarker creation and listener-adding code into a function
> that you call from your XML parsing code for each marker, passing data
> to it.  This will ensure you get function closure.   It's not an easy
> concept to grasp.
> Another XML based examplehttp://econym.org.uk/gmap/basic3.htm
>
> --
> 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 
> athttp://groups.google.com/group/google-maps-api?hl=en.

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