Hi Matt- I've replicated the inconsistency with the events. Please file it as a bug in the issue tracker so you can track its progress, and I'll report it to the team. Thanks!
- pamela On Sat, Apr 4, 2009 at 1:10 AM, jacques <[email protected]> wrote: > > The same behaviour occurs with polygons. To deal with this (personnaly > I prefer both events being fired) I put all the addListeners and > removeListeners in two functions in the map and deactivate/activate > the map listeners calling them from on ROLL_OVER or ROLL_OUT event > handlers in the polygon : > > function addMapMouseListeners():void { > map.addEventListener(MapMouseEvent.MOUSE_DOWN,onMapMouseDown); > map.addEventListener(MapMouseEvent.MOUSE_UP,onMapMouseUp); > } > function removeMapMouseListeners():void { > map.removeEventListener(MapMouseEvent.MOUSE_DOWN,onMapMouseDown); > map.removeEventListener(MapMouseEvent.MOUSE_UP,onMapMouseUp); > } > > On Apr 3, 10:11 am, matt <[email protected]> wrote: > > It seems that different overlay types behave differently in terms of > > firing events. I would guess that one of these is a bug but even > > after reading the documentation I am a little unclear as to which one > > is correct. > > > > My case: > > > > - I add a marker and a polyline to a map. Each overlay is listening > > for MOUSE_UP and MOUSE_DOWN events. Note that the marker is draggable > > to overcome a previously noted issue ( > http://code.google.com/p/gmaps-api-issues/issues/detail?id=1156). In > > addition, the map itself is listening for MOUSE_UP and MOUSE_DOWN > > events. > > > > - I click on the marker and then on the polyline. > > > > The results... > > > > For the marker, one MOUSE_UP and one MOUSE_DOWN event is generated > > with the feature/target set to the Marker > > > > For the polyline, two MOUSE_UP and two MOUSE_DOWN events are > > generated. One pair has the feature/target set to the polyline and > > one pair has the feature/target set to the map itself. > > > > I can't imagine that this by design. I believe that I can work around > > the issue but I would rather work around it by coding for the correct > > behaviour so that it will work properly in the future if the issue is > > resolved. Also, I would be happy to add this as a bug but I wasn't > > sure which one to reference. > > > > The example code below demonstrates the issue. > > > > private function onMapReady(event:Event):void { > > map.setCenter(new LatLng(48.858842, 2.346997), 14, > > MapType.NORMAL_MAP_TYPE); > > > > var pnts:Array = new Array( > > new LatLng(48.858842, 2.346997), > > new LatLng(48.958842, 2.646997)); > > var polylineA:Polyline = new Polyline(pnts); > > polylineA.addEventListener(MapMouseEvent.MOUSE_DOWN, > > onMapMouseDown); > > polylineA.addEventListener(MapMouseEvent.MOUSE_UP, > > onMapMouseUp); > > map.addOverlay(polylineA); > > > > var markerA:Marker = new Marker( > > new LatLng(48.858842, 2.346997), > > new MarkerOptions > > ( > > { > > draggable: true > > } > > )); > > markerA.addEventListener(MapMouseEvent.MOUSE_DOWN, > > onMapMouseDown); > > markerA.addEventListener(MapMouseEvent.MOUSE_UP, > > onMapMouseUp); > > map.addOverlay(markerA); > > > > map.addEventListener(MapMouseEvent.MOUSE_DOWN, > > onMapMouseDown); > > map.addEventListener(MapMouseEvent.MOUSE_UP, onMapMouseUp); > > > > } > > > > private function onMapMouseDown(event:MapMouseEvent):void > > { > > trace("MapMouseDown:" + event.feature + ", " + event.target); > > } > > > > private function onMapMouseUp(event:MapMouseEvent):void > > { > > trace("MapMouseUp:" + event.feature + ", " + event.target); > > } > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
