Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am currently working with a drawing tool for the ESRI Flex API, and every time I double-click the mouse a map service will perform a measurement and display the length of the line that I am drawing.

I want to mimic this double-click manually by dispatching a MouseEvent.DOUBLE_CLICK, but the map service is not listening to this default Flex event. I suspect that the API has created a custom MapMouseEvent or something like it that is being dispatched when a user double-clicks the mouse.

Does anyone know which event is being dispatched when I double-click the mouse on the map?

share|improve this question
    
Do you mean clicking twice, or clicking both the right and left buttons? –  Nathanus May 13 '11 at 21:06
    
Clicking twice. –  Kyle May 13 '11 at 21:16
add comment

3 Answers

Does anyone know which event is being dispatched when I double-click the mouse on the map?

Multiple events are dispatched, including the standard DOUBLE_CLICK. Among the Flex API samples there is an "Events" example which you can play with to see this: http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=EventBasics

share|improve this answer
add comment

You should get the effect you want if you add your MouseEvent to the map and disable whatever event is firing that is interfering. I would guess that the problem is that the event for double-click zooming is firing. You can disable it by using the map's doubleClickZoomEnabled property.

If your problem is that you want to add a graphic to the screen that has special functionality and otherwise you'd like double clicking to perform as usual then this post:

http://stackoverflow.com/questions/2089265/set-a-double-click-event-without-disabling-default-mouseup-mousedown-behavior

should be sufficient to fix that problem.

share|improve this answer
add comment
up vote 0 down vote accepted

After playing around with the API a bit, I found a solution. One thing I learned is that even custom events need to listen to the built-in Flash events (e.g. MouseEvent.DOUBLE_CLICK) in order to dispatch their own events.

The Flex API actually dispatches a number of events when a double-click is fired, including a MapMouseEvent.MAP_CLICK, MouseEvent.MOUSE_DOWN, MouseEvent.MOUSE_UP, and MouseEvent.DOUBLE_CLICK events (in that order). The MapMouseEvent is a crucial step in the series - it seems like the draw tool will listen for this event to be dispatched before listening for other mouse events (like a double-click).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.