[OpenLayers-Users] mouseover event creation for looped marker creation

Andrew Schuh andys at neptuneinc.org
Tue Sep 30 13:47:03 EDT 2008


I have a question regarding event handling.  I'm new to this and I'm having a
bit of trouble.  I'm looping over marker creation and I have a vector of
data that is updated on each iteration of loop (tmpmarks array with 4
members).  This works fine for the marker creation and placement but I would
like to add information to be placed within a div tag on the web page based
on mouseover.  It seems that the mouseover event is not statically created
at the time it is defined and when it is called it always pulls the last
value of tmpmarks for all markers.  I'm sure this is just my lack of
understanding about event handling but could anybody give me advice on how
to get around this?   Thanks in advance for any advice.

......
var marktmp = new OpenLayers.Marker(new
OpenLayers.LonLat(tmpmarks[0],tmpmarks[1]),iconblue.clone())
marktmp.events.register('mouseover',marktmp,function(evt)
                       
{filldiv('clustersizediv',tmpmarks[2]);filldiv('samplediv',tmpmarks[3]); });
marktmp.events.register('mouseout',marktmp,function(evt)
                        
{blankdiv('clustersizediv');blankdiv('samplediv');OpenLayers.Event.stop(evt);
});
markers.addMarker(marktmp);}
.....
-- 
View this message in context: http://www.nabble.com/mouseover-event-creation-for-looped-marker-creation-tp19747097p19747097.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list