Google maps flex API: handle both double and single clicks?

how can you specify one click on double click? my single Generally the click listener captures all double clicks:

tz locator

this is a known issue for the flash / flex API, but the js workaround doesn't seem to handle both: code.google.com

0


source to share


1 answer


You might need to clarify a bit, but make sure you are using Google Map MapMouseEvent and not Flash API click events (please take this code inside a subclass Map

):



public class GoogleMap extends Map 
{
    import com.google.maps.LatLng;
    import com.google.maps.Map;
    import com.google.maps.MapEvent;
    import com.google.maps.MapMouseEvent;

    public function GoogleMap():void
    {
        super();
        this.key = "YOUR_API_KEY";

        addEventListener(MapEvent.MAP_READY, _onMapReady);
        addEventListener(MapMouseEvent.CLICK, _onMapClick);
        addEventListener(MapMouseEvent.DOUBLE_CLICK, _onMapDoubleClick);
    }

    protected function _onMapClick(event:MapMouseEvent):void 
    {  
        trace("single!");
        var mousePoint:Point = new Point(mouseX, mouseY);
        var mousePointLocal:Point = globalToLocal(mousePoint);
        var mouseLatLng:LatLng = this.fromViewportToLatLng(mousePointLocal); 
    }

    protected function _onMapDoubleClick(event:MapMouseEvent):void 
    {
        trace("double!");
    }

    protected function _onMapReady(event:MapEvent):void 
    {
        trace("ready!")
    }
}

      

+1


source







All Articles