Hi

I resolved the CLICK & DOUBLE_CLICK issue as follows:

I handle a CLICK event by clearing a "double_click" flag and then set
a timer to call function "X" in 500 milliseconds.
I handle the DOUBLE_CLICK event by simply setting the "double_click"
flag.

Function "X" examines the "double_click" flag: if it's set, we have a
double click event to handle; otherwise we have a single click event
to handle.

You can see how this performs by visiting

http://spatialdatabox.com/million-marker-map/million-marker-map.html

and zooming in until you see individual markers. You can still double-
click the map to zoom in, or single click over a marker to display the
info window (the markers, info window and the user's interaction with
them is custom, which is why I handle all click events myself.)

Here's the relevant code snippet, if you're curious:


"in constructor" {
        map.addEventListener(MapMouseEvent.CLICK, onClick);
        map.addEventListener(MapMouseEvent.DOUBLE_CLICK, onDoubleClick);
}

private function onClick (e:MapMouseEvent):void
{
        if (! handCursor.isVisible ()) {
                //      Click is active only if hand cursor is visible.
                return;
        }

        doubleClickEvent = false;
        clickLatLon = e.latLng;

        //      Wait to ensure this click isn't part of a double-click event.

        clickTimer = new Timer (DOUBLE_CLICK_INTERVAL_MSEC, 1);
        clickTimer.addEventListener(TimerEvent.TIMER, doClickTimer);
        clickTimer.start ();
}

private function onDoubleClick (e:MapMouseEvent):void
{
        doubleClickEvent = true;
        clickLatLon = null;
}

private function doClickTimer (e:TimerEvent):void
{
        if (doubleClickEvent || clickLatLon == null) {
                //      Click was part of a double-click event.
                return;
        }


        //      Handle single click event ...
      :
      :

}


Thank you


On Mar 2, 1:44 am, sydney <[email protected]> wrote:
> On 27 Feb, 21:13, Richard <[email protected]> wrote:
>
> > I ended up just listening for the MOUSE_DOWN and inferring my own
> > click.
>
> > If you have to, you can catch the CLICK or MOUSE_DOWN and either:
>
> > Create a timer, and have that TIMER event perform the click activity
> > (make sure you null-out the persistent timer reference variable)
> > or
> > See that the timer exists, kill it, and perform theDOUBLE_CLICK
> > activity.
>
> As an ugly workaround, I tried catching the MOUSE_DOWN event and
> setting up a timer. If I get another MOUSE_DOWN before the timer
> expires then I have a double click and otherwise I have a single
> click. Anyway, this did not work because if the two mouse clicks of a
> double click are too close to each other (as it is the case in a
> typical double click) then I don't receive the second MOUSE_DOWN event
> at all. I kind of solved the problem by asking the user to press the
> Shift key while performing a click, but I'm still looking for a better
> solution.
>
> Sydney
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to