Search code examples
apache-flexgisesriarcgis-server

Set a double click event without disabling default mouseup/mousedown behavior


I'm trying to enable a double click event on a flex control without disabling the default mouseup/mousedown behaviors.

I'm using the ESRI Flex API for arcgis server, and I have a map control with one background layer and a GraphicLayer. The graphics layer has several Graphic objects that respond to mouseover, and allow the user to pan the map if they click and hold. However, when I implement a double click event handler for the graphic objects, they no longer seem to bubble up their default behavior to the map.

Is there a way to implement a double click on a Graphic object while preserving the old behavior from clicking and holding?


Solution

  • I solved this by attaching the double click event to the map, rather than the graphic, and using the target attribute of the event to get the graphic I wanted to use.

    Like this:

    map.addEventListener(MouseEvent.DOUBLE_CLICK, function(event:MouseEvent):void
    {
        var graphic:Graphic = event.target as Graphic;
        if(graphic)
        {
            ...
        }
    });