On Jul 20, 8:28 pm, Christopher Watson <[email protected]>
wrote:
> hey, even with an example, i'm struggling to adapt. sorry. can anyone point
> out where its going wrong?

forgot a link:
http://visualisationmagazine.com/dineography2.htm

>
> if i can push the overlays into this array:
>
> var overlay = [];
>
> with this it just keeps error'ing as not defined.

function overlayAdd()
{
overlays.push(overlay);   <-------- what is overlay here?

var sw = new google.maps.LatLng(53.389062, -1.307373) ;
var ne = new google.maps.LatLng(53.360387, -1.240082) ;
var bounds = new google.maps.LatLngBounds(sw,ne) ;
overlay = new ProjectedOverlay(map,'dinnington.jpg', bounds,
{percentOpacity:100}) ; <--- now overlay is something useful

---
try something more like this:
function overlayAdd()
{
var sw = new google.maps.LatLng(53.389062, -1.307373) ;
var ne = new google.maps.LatLng(53.360387, -1.240082) ;
var bounds = new google.maps.LatLngBounds(sw,ne) ;
var overlay = new ProjectedOverlay(map,'dinnington.jpg', bounds,
{percentOpacity:100}) ; <--- now overlay is something useful
overlays.push(overlay);   <-------- now push it on the array



>
> can i still use the setOpacity to control all the overlays and change their
> opacity?

Yes. By iterating through the array:

for (var i=0; i < overlays.length; i++) {
  overlay[i].setOpacity(desiredOpacity);
}

> or have i to settle on using the clearOverlays()?
>
> <a href="javascript:overlay.setOpacity(25)" style="text-decoration:
> none;">25%</a>

to use it like this I would write a function:
function setOpacities(desiredOpacity) {
  for (var i=0; i < overlays.length; i++) {
    overlay[i].setOpacity(desiredOpacity);
  }
}
then this should work:
<a href="javascript:setOpacities(25)" style="text-decoration:
> none;">25%</a>
>
> appreciate the help.
>
> thanks
>
> chris

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to