Hi,

map.layers is an array, not an object literal. So your loop is wrong.
Instead, do

for (var i=0, ii=map.layers.length; i<ii; ++i) {
    var layer = map.layers[i];
    // rest of your code
}

Andreas.

On Mon, Jan 16, 2012 at 5:50 PM, Juan Martin <cowaboon...@gmail.com> wrote:
> Hello back again,
>
> This is the code that doesn't work properly now...
>
> for (layername in map.layers) {
>         // if the layer is turned off, skip it
>         var layer = map.layers[layername];
>         if (!layer.getVisibility()) continue;
>         CapasActivas.push(layer.name.toString());
>         CapasActivas_json = JSON.stringify(CapasActivas.toString());
> }
>
> That give me a list of active layers for playing around with them but
> problem now is with getVisibility that looks to be not a valid method...
>
> anyone can help?
>
> Regards,
>
> Juan
>
> _______________________________________________
> Users mailing list
> Users@geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to