开发者

Google Maps & Flex: Clearing Markers

I'm using Google Maps with Flex 3.

I'm having problems clearing markers.

Users can select which data they want marked on the map by selecting an item in a comboBox.

I also have a button that clears the markers:

<mx:Button id="clearButton" label="Clear Markers" 
        click="markerManager.clearMarkers(); 
        />

If the user selects "Parks", for example, in the comboBox and then clicks the clear button. It works fine. The markers are cleared.

My problem o开发者_Go百科ccurs when the user selects "Parks" in the comboBox, then selects "Pools", for example, (so that two sets of markers are displayed) and then clicks the clear button. Only the last set of markers, the "Pool" markers, are cleared. The "Parks" markers are still visible.

The markerManager must get re-set after "Pools" is selected and loses its reference to the first set of markers.

I could clear all of the markers by using map.clearOverlays(). But, then I would lose a polyline that I want to remain on the map. I could always re-draw the polyline, but I was wondering if there is a better solution.

Any suggestions?

Thank you.

-Laxmidi


Seems to me that you're overriding your market 'container' in between selections in the combobox. If I were you, I'd add a clear in between change selections in the combobox:

<s:Combobox ... change="markerManager.clearMarkers()" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜