[OpenLayers-Users] changelayer event

Franz Buchinger fbuchinger at gmail.com
Wed Aug 4 10:23:10 EDT 2010


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 <mengukagan at gmail.com>

>
> 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
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100804/8373300f/attachment.html


More information about the Users mailing list