[OpenLayers-Users] changelayer event

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Wed Aug 4 09:54:47 EDT 2010


Hi,

use e.layer instead. It will contain the modified layer.

Best regards,
Bart
>
> Hello everyone.
>
> I am listening the "changelayer" event on map.events like this:
>
>     ctx.map.events.on({
>         "changelayer": function(e) {
>             if(e.property === "visibility") {
>                         alert(e.object.baseLayer.name);
>             }
>         }
>     });
>
> the problem here is, when i check the the baseLayer.name via
> console.log(e)
> I see the newly selected layer's name but when I use alert() I get the
> previously selected layer's name.
>
> my goal here is to get the newly selected layer's name and index from the
> layer switcher. any help or direction is appreciated.
>
> thanks in advance.
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/changelayer-event-tp5372564p5372564.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
>


-- 
Looking for flexible support on OpenLayers or GeoExt? Please check out
http://www.osgis.nl/support.html

Bart van den Eijnden
OSGIS
bartvde at osgis.nl




More information about the Users mailing list