How to change opacity of overlaymaptypes?

google-maps, google-maps-api-3, javascript

Solution

In 3.28 you have to use the getter. Please try the following code:

map.overlayMapTypes.getAt(0).setOpacity(0.25)

Problem

How do I change the overlayMapType opacity after I added to the map? ``` var imgTypeOptions = { getTileUrl: function (coord, zoom) { return "myTile/" + f + ".png"; }, tileSize: new google.maps.Size(256, 256), name: "Imagen", opacity: .5 //This is Ok, the first time set the opacity //but i want to change the opacity later }; ... var imgMapType = new google.maps.ImageMapType(imgTypeOptions); ... map.overlayMapTypes.insertAt(0, imgMapType); ``` I want to be able to click a link "25%" and set the opacity of the added layer to 25%.

Original source