[GIS] OpenLayers – cannot set layer opacity

javascriptlayersopacityopenlayers-2vector

I have the following problem: by default, you can simply change the opacity of layer by writing for example:

layer.setOpacity(0.3);

But when I add it to my map SelectFeature controls, my layer is put to a thing like OpenLayers.Vector.RootContainer. From this moment I can't set opacity of my layer.
I tried lots of ways but none of them work:

myVectorRootContainer.layers[0].setOpacity(0.4);
myVectorRootContainer.setOpacity(0.4);

Is there an option for using SelectFeature controls without RootContainers? Or a way to change opacity of a container?

Best Answer

OK, I found the solution. I use deactivate and activate on my SelectFeature controls, when I need to set opacity.