[OpenLayers-Users] select feature control not working

Imran Rajjad rajjad at gmail.com
Thu Jun 3 06:01:37 EDT 2010


I`m trying to run a function on clicking and highlighting of a vector
layer. the events do not seem to trigger..

what am i doing wrong here?

my code



var report = function(e) { // it will be called when event is trigered
from eventListeners
                console.log(e.type, e.feature.id);
                //alert(e.feature.id);

            };

            var highlightCtrl = new
OpenLayers.Control.SelectFeature(vector_layer, {
                hover: true,
                highlightOnly: true,
                renderIntent: "highlight",
                eventListeners: {
                    beforefeaturehighlighted: report,
                    featurehighlighted: report,
                    featureunhighlighted: report
                }
            });

            var selectCtrl = new OpenLayers.Control.SelectFeature(vector_layer,
                {clickout: true}
            );

            map.addControl(highlightCtrl); // add high lighting
            map.addControl(selectCtrl); // add selection

            highlightCtrl.activate();
            selectCtrl.activate();

-- 
I.R



More information about the Users mailing list