(TPolygon.SetOnClickListener Method)
Registers an event handler for mouse-click event on a polygon. The argument-callbackFunction is a function which would be called when the polygon is clicked with the mouse. You should implement the callbackFunction.
public SetOnClickListener(callbackFunction : Object):Void
<div id="mapContainer" style="width: 640px; height: 400px;"></div>
<script type="text/javascript">
var map0 = new TMap(mapContainer, 25.7590256665386, -80.3738769902151, 15, mapLoaded, 1, true, "", "hybrid");
function mapLoaded() {
var layer0=map0.AddLayer();
polygon0=layer0.AddPolygon("25.7609634245936,-80.3810464518457;" + //You need to add the vertexes of
"25.7611702422549,-80.3686484471929;" + //the polygon in a string.
"25.7469942429429,-80.3680055121408;" +
"25.7464559403514,-80.3839931698344;" +
"25.7574231613382,-80.3843195004342", //Notice! DO NOT add a ";" for the last vertex.
"FILL_COLOR=0xAACCFF;FILL_ALPHA=50;LINE_COLOR=0xFFFFFF;LINE_WIDTH=2;LINE_ALPHA=100");
//Set polygon on click listener
polygon0.SetOnClickListener(
function(){
alert("polygon0 clicked.");
}
};
}
</script>