0
votes

I've been googling this "issue" for a while now without any luck. Is there a way to change the frequency, speed, or what ever you want to call it of the double clicks? I mean, increas the time between clicks and still register it as a double click.

1

1 Answers

3
votes

I would imagine that this is determined by the operating system as users with different accessibility needs have different double click timings. Therefore, I don't think this is possible to modify using the flash player.

However, if you want to simulate the above, I'd do something like the following:

    private var timer:Timer = new Timer(1000, 1);

    private var singleClickEvent:MouseEvent;

    public function onSingleClick(event:MouseEvent):void
    {
        if (timer.running)
        {
            timer.removeEventListener(TimerEvent.TIMER_COMPLETE, timerComplete);
            timer.stop();
            dispatchEvent(new MouseEvent(MouseEvent.DOUBLE_CLICK));
        }
        else
        {
            singleClickEvent = event;
            timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerComplete);
            timer.start();
        }
    }

    private function timerComplete( event:TimerEvent ):void
    {
        dispatchEvent(singleClickEvent.clone());    
        singleClickEvent = null;
    }

Basically... when you click once start a timer, if that timer triggers then dispatch a normal CLICK event. If the user clicks again before the timer has fired, that's a double click and dispatch a DOUBLE_CLICK.