myMarker.addEventListener(MapMouseEvent.MOUSE_DOWN,downHandler) registers the function downHandler to the event... From the code supplied that function does not exist. The moveHandler and upHandler never get initialized because editHandlerDown is never called by the supplied code.
On Dec 30, 6:03 am, GriGri <[email protected]> wrote: > I have a problem with MapMouseEvent. > My main goal is to click a marker & drag it to a new position on the > map. I want to stop the drag on MapMouseEvent.MOUSE_UP, but this > doesn't work. I've tried adding the mouse_up listener to both the > marker as the map, with no success. > Here's a snippet from my code: > > private var currentMarker; > > private function initMarkers():void{ > myMarker.addEventListener(MapMouseEvent.MOUSE_DOWN,downHandler)} > > private function editHandlerDown(e:MapMouseEvent):void { > currMarker = = e.target; > map.addEventListener(MapMouseEvent.MOUSE_UP,upHandler); > map.addEventListener(MapMouseEvent.MOUSE_MOVE,moveHandler);} > > private function moveHandler(e:MapMouseEvent):void { > currMarker.setLatLng(e.latLng);} > > private function upHandler(e:MapMouseEvent):void { > map.removeEventListener(MapMouseEvent.MOUSE_UP,upHandler) > map.removeEventListener(MapMouseEvent.MOUSE_MOVE,moveHandler) > > } > > I guess the MOUSE_UP event isn't fired because the marker sits in the > way for detecting the event on the map. > Adding the listener to the marker doesn't work either. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
