Hi Mengu,<br><br>I suppose you want to detect the newly activated baselayer in the layer switcher.<br><br>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).<br>
<br>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 &lt;ok&gt;. 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.<br>
<br>Or simply follow Barts advice.<br><br>Franz<br><br><br><div class="gmail_quote">2010/8/4 Mengu <span dir="ltr">&lt;<a href="mailto:mengukagan@gmail.com">mengukagan@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Hello Bart,<br>
<br>
Thanks for the reply.<br>
<br>
I have tried <a href="http://e.layer.name" target="_blank">e.layer.name</a> and <a href="http://e.layer.map.baseLayer.name" target="_blank">e.layer.map.baseLayer.name</a> and both provides<br>
me the previously selected layer&#39;s name.<br>
<br>
Is there events that I should listen instead of map&#39;s &quot;changelayer&quot; event?<br>
Maybe there&#39;s something for LayerSwitcher?<br>
<font color="#888888">--<br>
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/changelayer-event-tp5372564p5372665.html" target="_blank">http://osgeo-org.1803224.n2.nabble.com/changelayer-event-tp5372564p5372665.html</a><br>

</font><div><div></div><div class="h5">Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br>