Monday, November 22, 2010

[Google Maps API v2] Re: Bug in removing Gpolygon circle v2

On Nov 20, 8:21 am, danny <i...@duniapermainan.com> wrote:
> The polygon is created, you say its never created, thats wrong. on
> mouseover its created and i want it to be removed on mouseout

Sorry, but Rossko is correct, and you are wrong:
Section of code from your test function:
var polygon = new GPolygon(points, "#f33f00", 1, 1, "#ff0000", 0.1);
*** This creates a brand new variable called polygon, that is local to
your test function ***
if (r==0){
map.removeOverlay(polygon);
*** if r==0 then remove the brand new polygon from the map, but you
have not added it to the map yet as you have only just created the
polygon variable, so there is nothing to remove ***

} else {

map.addOverlay(polygon);
*** this will add a polygon to the map using the new polygon variable
from above ***
}
} // end

*** and the end of your test function the new polygone variable is
deleted, and can no loger be referenced, next time you call test it's
a brand new polygon variable ***

*** When you first call test(x,y,600); it will create the poygon, but
then imediably forget the polygon variable.
When you next call test(x,y,0); you make a brand new polygon variable,
that is not added to the map, but you then attempt to remove 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 google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate