jack,

there are actually quite a few issues with scope. honestly, you're
very lucky that this even loads and runs as well as it does because
you are in-lining your map initialization, as opposed to calling a
function with onload event in body tag. this can create many small
little problems.

On a positive note, the code does look ok, but you need to re-work the
entire thing with respect to your scope of various objects...

as an immediate fix, you may want to find wherever you are doing this:

        gmarkers[i] = marker;
        historys[i] = html1;
        infos[i] = html2;
        contacts[i] = html3;


and just replace with the following (or similar), by using push
instead
        gmarkers.push(marker);
        historys.push(html1);
        infos.push(html2);
        contacts.push(html3);

That may solve this immediate issue that you are posting about, but I
have a feeling that the more you fix, the more you will find is broken
because of how variables are being declared and used and the vague
scope, as well as your functions. For example, all of your functions
are declared inside the scope of an if statement, but your functions
should be at least global in scope...furthermore, all your 'global'
variables such as your arrays are created inside the same if
statement...

Good luck...

thanks,
terry



On Jul 21, 11:52 am, jacksplatt11 <[email protected]> wrote:
> Hi, I'm just after some help with marker clusterer if anyone is
> familiar with it. My site 
> ishttp://homepage.cs.latrobe.edu.au/tescoberg/maps/trial.html.
> I know I only have a few markers on it at the moment, but in future
> their will be more so don't worry about that too much. The problem is,
> I cant seem to get marker clusterer to work. I have this in the head
> after the google maps api key/script part:
> <script type="text/javascript" src="markerclusterer.js"></script>
>
> Then in the body, after all the markers have been read from file and
> added to an array:
>
> var markerCluster = new MarkerClusterer(map, gmarkers);
>
> I have this, just for testing, which should return 8, but it's
> returning 0, meaning the markers aren't getting added?
>
> alert(markerCluster.getTotalMarkers());
>
> Any help would be greatly appreciated
--~--~---------~--~----~------------~-------~--~----~
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