It is also good practice to explicitly define your global variables and not rely on the script engine to create them for you. Some just wont.
On Tue, Feb 23, 2010 at 9:33 AM, Lance Dyas <[email protected]> wrote: > Hint: You will need more than one variable (an array probably) if you want > to be > able to remove more than just the last one your added. > > On Tue, Feb 23, 2010 at 2:39 AM, Krad <[email protected]> wrote: > >> Ok i have updated the API key and add the other tick boxes to work up >> to Pub and Bars. The bit that does not work is the map.remove >> Overlay(kml) >> where kml is the variable for the file url. >> >> I read the bit about global and if you remove var it becomes global to >> calls in the programm. So I tried that and nothing you tick and >> markers load you clikc the tick again and nothing. I have used >> firebug in Firefox to follow with the break points set and its doing >> the above steps on untick:- >> >> PDL >> >> IF (checked) ---- false >> { >> load map kml overlay >> } >> else >> remove map kml overlay --- picks up the url with the file name been >> pased in via the onclick call. >> } >> >> I'v look at loads of examples and they have simlar to the above and >> they work? What am I doing wrong. >> >> >> >> On Feb 22, 11:21 pm, "[email protected]" <[email protected]> >> wrote: >> > On Feb 22, 12:58 pm, Krad <[email protected]> wrote: >> > >> > > Hello, >> > >> > > I'm having truble with the remove of a kml overlay when a checkbox is >> > > used can some one help? >> > >> > >http://www.mu130.acres-air.co.uk/map2.html >> > >> > I get a key error on that page, then a map >> > All the checkboxes except the first give errors because the functions >> > they call don't exist. >> > >> > Removing the overlay generates an error because: >> > map.removeOverlay(); >> > >> > is not the correct syntax. >> http://code.google.com/apis/maps/documentation/reference.html#GMap2.r... >> > >> > removeOverlay takes an argument (the overlay you want to remove). >> > >> > working example:http://www.geocodezip.com/GenericMapBrowser.asp >> > see the "addTrafficOverlay()" function. >> > >> > -- Larry >> > >> > >> > >> > > the code is this:- >> > >> > No thanks. >> > >> > > it loads the overlay just can't get it to remove? >> > >> > > also would I get more problems with more overlays and the memeroy >> > > location of the kml?? >> > > l=en<http://groups.google.com/group/google-maps-api?hl=en> >> . >> >> > -- 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.
