you should work with layer's event "visibilitychanged"

    layer1.events.register("visibilitychanged", layer1, function() {
            if (this.getVisibility()) {
                layer2.setVisibility(false);
            }
        });

        layer2.events.register("visibilitychanged", layer2, function() {
            if (this.getVisibility()) {
                layer1.setVisibility(false);
            }
        });

Am 13.05.2011 09:36, schrieb Boer, dr. W.M. de (Thijs):
Hello list members,

In an OL application I would like to switch 1 layer on and at the same time, 
switch another layer off (in the layerswitcher panel).
Both layers are overlays. So the on/off of these two layers in the 
layerswitcher are connected as it were.
Is this possible and if so, has anyone a bit of code for it ?

Kind regards

Thijs de Boer
........................................................................
GIS Competence Center
Dienst Landelijk Gebied
Postbus 20021  | 3502 LA  | Utrecht
........................................................................
F 030 275 69 99
M 06 52 40 10 69
[email protected]

Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u
niet de geadresseerde bent of dit bericht abusievelijk aan u is gezonden,
wordt u verzocht dat aan de afzender te melden en het bericht te
verwijderen.
De Staat aanvaardt geen aansprakelijkheid voor schade, van welke aard
ook, die verband houdt met risico's verbonden aan het elektronisch
verzenden van berichten.

This message may contain information that is not intended for you. If you
are not the addressee or if this message was sent to you by mistake, you
are requested to inform the sender and delete the message.
The State accepts no liability for damage of any kind resulting from the
risks inherent in the electronic transmission of messages.


_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to