On May 18, 3:26 pm, James_UNB <[email protected]> wrote:
> My website:http://www.omg.unb.ca/~jmuggah/May11_11_try.html
>
> I am trying to resize an image according to the zoom level. After the user
> zooms into the highest level (19) and zooms back out, the old GControl
> remains behind the new GControl. Is there a way to remove the old GControl
> upon zoom level change?

When zoom changes, your function creates an entirely new control:
            var ShipImg = new GControl;
            Ship.prototype = ShipImg;
and then does this:
            map.removeControl(ShipImg);
            map.addControl(ShipImg);

You're not retaining a reference to the control you create in order
that you can remove it later on. Define a global variable to which you
can assign the newly-created control, in order that you can remove it
when you need to.

(Although you say the old control remains behind the new control when
zooming out, it's actually doing that when zooming in as well. The
zoomed-in control is larger and completely hides the old control
behind it.)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" 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-api?hl=en.

Reply via email to