[OpenLayers-Users] Layer.opacity is always null

Greg Ederer greg at ergonosis.com
Tue Dec 16 19:39:38 EST 2008


Looking at the source (trunk), I see:

1085         /**
1086          * APIMethod: setOpacity
1087          * Sets the opacity for the entire layer (all images)
1088          *
1089          * Parameter:
1090          * opacity - {Float}
1091          */
1092         setOpacity: function(opacity) {
1093             if (opacity != this.opacity) {
1094                 this.opacity = opacity;
1095                 for(var i=0, len=this.div.childNodes.length; i<len; 
++i) {
1096                     var element = this.div.childNodes[i].firstChild;
1097                     OpenLayers.Util.modifyDOMElement(element, null, 
null, null,
1098                                                      null, null, 
null, opacity);
1099                 }
1100             }
1101         }

Line 1094 should give me what I need.  Is this the same in 2.7?  Is 
there some other mixin in OpenLayers.Layer.WMS that overrides this method?

I might be able to get the opacity value by examining 
layer.div.childNodes[0].  But, I suspect that this is set in a 
browser-dependent way; so it might be a bit of a pain to ensure that I 
always get the correct value.

Any ideas?

Thanks!

Greg

Greg Ederer wrote:
> Hi,
>
> I saw an earlier post that recommended using the opacity property to 
> access the opacity value of a layer; however, on my OpenLayers.Layer.WMS 
> layers, the opacity property always contains a null value.  Any suggestions?
>
> Thanks!
>
> Greg
>
>   


-- 
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| greg at ergonosis.com
| 360.774.6848
|




More information about the Users mailing list