[ka-Map-users] Using kaXmlOverlay mouse event(s)

Schalk Snyman schalk at wor-x.com
Wed Mar 28 09:59:31 EST 2007


Hi all kaMap frontiers!

Background
I am trying to place data from a database onto my map by calling an AJAX page every 10s, where the javascript is placed in a string, which is evaluated in my callback function. Each element loaded must have its own tooltip containing several parameters; and a pop-up menu. Therefore I need a mouseover and click event handler for the element.

The challenge
I checked out the newest kaMap source from CVS and copied the XMLOverlay folder to my code directory. I also wrote a mouseover event handler in kaXmlOverlay.js based on the onClick event handler written by PG. Here is my implementation for the onClick event on my php AJAX-called page.

--------------------------------------------------------------------------------------------------------------------------------------
$szLayers .= "var my_point = dynXmlOverlay.addNewPoint(objectId, longitude, latitude);";
$szLayers .= "var my_icon = new kaXmlIcon();";
$szLayers .= "my_icon.icon_w = 28;";
$szLayers .= "my_icon.icon_h = 28;";
$szLayers .= "my_icon.icon_src = './data/images/site.gif';";
$szLayers .= "my_point.addGraphic(my_icon);";
$szLayers .= "my_point.enableOnclick;";
$szLayers .= "kaXmlOverlay.handler_onclick = function ( my_point ) {alert('ghdhd')};";
//toolTip.setText( mouseover );toolTip.moveGeo(latitude,longitude);
---------------------------------------------------------------------------------------------------------------------------------------

As seen from code I am currently just trying to throw an alert when one of the loaded images are clicked. It doesn't work, however. ;-(

Also the added objects "flicker" even though I only call the AJAX function, which load them, every 10s. ;-(

Any help to exonerate this situation would be hugely appreciated!!!

Schalk Snyman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20070328/6eb14052/attachment.html


More information about the ka-Map-users mailing list