> GEvent.addListener( marker, 'mouseover',
> marker.setImage("iconmo.php?
> n=" + cluster.markerCount));
...
> Any ideas?
You need to specify a function for the listener's third parameter.
You have
marker.setImage("iconmo.php?n=" + cluster.markerCount)
which is not a function as such, it's an expression. It gets
evaluated at the time the listener is created, and not when the
listener is triggered.
A valid listener definition could look like
GEvent.addListener( marker, 'mouseover', someFunction) ;
while
GEvent.addListener( marker, 'mouseover', someFunction(xx)) ;
won't do what you expect.
What most people do is create an anonymous function as they set up the
listener -
GEvent.addListener( marker, 'mouseover', function() {
marker.setImage("icon.php?n=" +
cluster.markerCount);
}
) ;
but you'd need to be sure cluster.MarkerCount is going to have the
value you are expecting when that listener gets triggered.
This isn't a maps issue, it's about using javascript event-driven
functions.
cheers, Ross K
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---