Hi Mengu, I suppose you want to detect the newly activated baselayer in the layer switcher.
If you activate a new baselayer in the layer switcher, you actually trigger 2 changelayer events: 1 for the old baselayer (because it gets invisible) and 1 for the new baselayer (because it gets visible). The problem is your alert-Statement in the callback. It blocks the triggering of the second changelayer event, because all Javascripts pause until you hit <ok>. If you perform a non-blocking logging action (e.g. write to console.log or in a logging div) you should see the 2 events. Or simply follow Barts advice. Franz 2010/8/4 Mengu <[email protected]> > > Hello Bart, > > Thanks for the reply. > > I have tried e.layer.name and e.layer.map.baseLayer.name and both provides > me the previously selected layer's name. > > Is there events that I should listen instead of map's "changelayer" event? > Maybe there's something for LayerSwitcher? > -- > View this message in context: > http://osgeo-org.1803224.n2.nabble.com/changelayer-event-tp5372564p5372665.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users >
_______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
