On Thu, Jun 10, 2010 at 2:04 PM, Rahn Hanno (rahn) <r...@zhaw.ch> wrote: > > Super, > > That works. And how can I register a changelayer listener on the map? I try > this: > > var options1 = { > maxExtent: new > OpenLayers.Bounds(662642.346412,152155.850000,726497.716088,206636.150000), > maxResolution:'auto', > numZoomLevels: '9', > fractionalZoom: true, > scales: [500000, 250000, 200000, 125000, 100000, 75000, 50000, > 25000, 10000], > units: 'm', > projection: "EPSG:21781", > controls: [] > }; > > var map = new OpenLayers.Map('map',options1, > eventListeners: { > "changelayer": function(e) { > if(e.property === "visibility") { > alert("visibility changed (" + e.layer.name + ")"); > } > } > } > ); > > It doesn't work.
eventListeners must be set in the map options new OpenLayers.Map('map', { eventListeners: { "changelayer": function(e) { if(e.property === "visibility") { alert("visibility changed (" + e.layer.name + ")"); } } } }); -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users