I think it is because when you call removeOverlay, the marker hasn't actually been added yet. The solution would be to check if the marker has been added before removing it, I believe.
Jonathan Scribblemaps.com On Dec 16, 6:03 am, Alexis <[email protected]> wrote: > Hello, > > I've an error about my code. > When I add a marker, it's working. > I remove my marker and I add again my marker (the same), I've an > error : > > ArgumentError: Error #2025: The supplied DisplayObject must be a child > of the caller. > at flash.display::DisplayObjectContainer/removeChild() > at com.google.maps.wrappers::SpriteFactory/removeChild() > at com.google.maps.wrappers::ISpriteFactoryWrapper/removeChild() > at com.google.maps.overlays::Marker/renderMarker() > at com.google.maps.overlays::Marker/redraw() > at com.google.maps.overlays::Marker/onAddedToPane() > at com.google.maps.overlays::Overlay/set pane() > at com.google.maps.overlays::Pane/addOverlay() > at com.google.maps.core::MapImpl/addOverlay() > at com.google.maps.wrappers::IMapWrapper/addOverlay() > at GoogleMap/addMarker()[/Users/Alexis/Sites/www/swf/GoogleMap.as: > 108] > > Code : > marker:Marker = new Marker(); > ... > map.addOverlay(marker); > map.removeOverlay(marker); > map.addOverlay(marker); > > How can I correct this problem ? > Thank you, > > Alexis -- 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.
