How can i setup a callback function for a click event on a pin?
I need both pins the green one (one location) and the red one (clustered locations).
I’m using the v6 api.
That’s the code so far:
var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(pin.position.lat, pin.position.lng));
shape.SetTitle('<h2>'+pin.overlay.headline+'</h2>');
shape.SetDescription('<p>'+pin.overlay.text+'</p>');
var pinIcon = new VECustomIconSpecification();
pinIcon.Image = '/images/map/pin.png';
pinIcon.TextContent = '.';
shape.SetCustomIcon(pinIcon);
The correct way to do this is to override the onclick and onmouseover
functions within VEMap.AttachEvent(); AttachEvent has many return values
useful in identifying which pin you click/mouseover, such as the pinID (elementID return value for the VEMap.onclick() method).
You can use the ID in combination with map.ShowInfoBox(), and map.GetShapeByID to
show your infobox upon click.
READ: VEMap.AttachEvent <– Google that, I’d paste the URL but I need more rep on StackOverflow
READ: VEMap.onclick. Also, Understand the return values:
READ All mouse events
http://msdn.microsoft.com/en-us/library/bb412438.aspx
Thats it