Whenever I try to use my own icon, I get weird behavior when I
mouseover the icon...

My application is supposed to display html on mouseover and close it
on mouseout..

One the top half  (or 2/3rds) of the icon, when I mouseover, I
immediately also get a mouseout event.   As a result, the html info
window appears to flicker on then immediately off.

However, in the bottom third or so of the icon, it works as you would
expect.  mouseover causes the infowindow to appear, mouseout causes
the infowindow to close.

If I use the standard icon, then it also works as you would expect on
the entire icon.

demo at:

     http://www.highlandsrowingcenter.org/rc/debug.html

code below...

I have tried using various values for the icon anchor, but that
doesn't seem to make a difference.

Suggestions??

Thanks,
Jeff




function userMap () {
        document.write('<font size=5>Maps</font><p>');
    if(!GBrowserIsCompatible()) {
                alert ("Browser doesn't support maps - sorry");
        } else {
                map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(41.0,-78.4), 13);

        // Draw a marker with the default pushpin icon
                draw_Marker(new GLatLng(41.0,-78.4),true);
                // Draw a marker with a custom icon
                draw_Marker(new GLatLng(41.005,-78.405),false);
        }
}

function draw_Marker(point,default_icon_flag) {
        var html = "This icon works correctly";
        if (!default_icon_flag) {
                var html = "Notice the mouseout flicker when moving the mouse 
over
the top half of the icon"
                var opt = {};
                var new_icon = new GIcon( {
                                        image:"icons/caution.png",
                                        iconAnchor: new GPoint(16,32),
                                        infoWindowAnchor:new GPoint(16,16)
                                                 });
                opt.icon = new_icon;
        }

        var marker = new GMarker(point, opt);

        GEvent.addListener(marker, "mouseover", function() {
                        marker.openInfoWindowHtml(html);
        });
        GEvent.addListener(marker, "mouseout", function() {
                        map.closeInfoWindow();
        });
        map.addOverlay(marker);
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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