I have been struggling with zoom to layer functionality with event listeners. The code is working and zoom to layer whenever it is loaded but the problem is that once it is loaded, i can not zoom or pan to other areas, and if i have more than 2 layers loaded with event listeners then it become messy. How do I remove or deactivate the event listener as soon the layer is loaded...Here is the code
var HSlay06 = new OpenLayers.Layer.MapServer('Human Settlement 2006',
"http://localhost/cgi-bin/mapserv?map=/var/www/html/mapfile/Human_Settlement2006.map", { map: "/var/www/html/mapfile/Huma_Settlement2006.map" }, { strategies: [new OpenLayers.Strategy.BBOX()], eventListeners: { 'loadstart': function (evt) { map.zoomToExtent(HSExtent); } } }, { transparent: true, numZoomLevels: 22, opacity: 0.5, visibility: false, isBaseLayer: false } );
أكثر...
var HSlay06 = new OpenLayers.Layer.MapServer('Human Settlement 2006',
"http://localhost/cgi-bin/mapserv?map=/var/www/html/mapfile/Human_Settlement2006.map", { map: "/var/www/html/mapfile/Huma_Settlement2006.map" }, { strategies: [new OpenLayers.Strategy.BBOX()], eventListeners: { 'loadstart': function (evt) { map.zoomToExtent(HSExtent); } } }, { transparent: true, numZoomLevels: 22, opacity: 0.5, visibility: false, isBaseLayer: false } );
أكثر...