Hi Bernat- The simple (naive) way would be to set .visible = false to all of the markers after calling addOverlay() on them.
A better way would be to avoid calling addOverlay() on the markers until after a checkbox is toggled. So you'd basically replace .visible = true/false with addOverlay/removeOverlay. - pamela On Tue, Apr 7, 2009 at 11:59 PM, bernattorras <[email protected]>wrote: > > Hi, > > I'm working in the Marker Toogle example to show and manage different > groups of markers in a map. I add the markers in the xml without a > problem but what I want to do is to change the comboboxes for buttons; > so the map starts showing 0 markers and when you click one button it > makes appear the propper markers. > > The fact is that when I click one button I would like to remove all > the markers that are currently visible to start showing the new ones. > > I assume that I should change the toggleCategory function to remove > all markers first in order to show the next ones once any button is > released, but I'm a totally neewbe to AS3 and I'm not sure how to do > it... > > Any ideas?? > > Here's the example link and the functions code: > > EXAMPLE: > http://gmaps-samples-flash.googlecode.com/svn/trunk/demos/MarkerToggleFlash/ > > "toggleCategory" FUNCTION CODE: > > function toggleCategory(type:String):void { > for (var i:Number = 0; i < categories[type].markers.length; i++) { > var marker:Marker = categories[type].markers[i]; > if (!marker.visible) { > marker.visible = true; > } else { > marker.visible = false; > } > } > } > > Thanks in advance! > > Bernat > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API For Flash" 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-for-flash?hl=en -~----------~----~----~----~------~----~------~--~---
