Use layer.mergeNewParams({TRANSPARENT: true}); instead.

Best regards,
Bart

Bart van den Eijnden
Front-end Developer | Boundless
@boundlessgeo

On Oct 12, 2013, at 6:38 PM, Tim Balschmiter <[email protected]> wrote:

> Hi List,
> i´ve generated a code to add wmc-layer as an Overlay to the map. My code use 
> a file chooser for take a wmc-document. After loading the layers, i can see 
> them on the map and i can see them in the switcher. But the transparency is 
> inaktiv at the beginning, after zooming or dragging the map, the transparency 
> works. How, can I change that is still working with loading the layers?
> 
> Here is my examplecode:
> [code]
> $('.btn.addWMC').click(function(e) 
>     {
>         var fileSelector = $('<input type="file" />').bind('change', 
> function(e)
>               {
>                       var file = this.files[0];
>                       var reader = new FileReader();
>                       reader.readAsBinaryString(file);
>                       reader.onloadend = function() 
>                       {
>                 extrawmc = reader.result; 
>                               extracontext = format.read(extrawmc,{map:map});
>                               for (var i=0; i<extracontext.layers.length;i++) 
>                               { 
>                                       var layer = extracontext.layers[i]; 
>                                       layer.params.TRANSPARENT = 'TRUE'; 
>                               }
>                               map.addLayers(extracontext.layers);
>             }
>         });
>         var wmc = fileSelector.click();
>         return false;
>     });  
> [/code]
> Thanks for helping me 
> Tim
> 
> 
> _______________________________________________
> 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