Skip to main content
November 6, 2009
Answered

Click and DoubleClick Problem

  • November 6, 2009
  • 1 reply
  • 618 views

I'm currently trying to set up event handlers for both click and double click events, but only the function relating to the click event is ever called. Both event listeners are simply attached to the stage in exactly the same way e.g.

stage.addEventListener(MouseEvent.DOUBLE_CLICK, CancelSelection);
stage.addEventListener(MouseEvent.CLICK, MoveObject);

Yet the use of the trace command in each function reveals that the double click function, CancelSelection, is never called.

The code in cancel selection is simply:

private function CancelSelection(evt:MouseEvent):void
{
     trace("Deselecting...");

}

And ideas what's going wrong here?

This topic has been closed for replies.
Correct answer Ned Murphy

Try including the following line of code ahead of all of that...

stage.doubleClickEnabled = true;

The default value is false, which is why you don't automatically get the double click working.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
November 6, 2009

Try including the following line of code ahead of all of that...

stage.doubleClickEnabled = true;

The default value is false, which is why you don't automatically get the double click working.

November 8, 2009

Ah I didn't know that! Thank you that should hopefully work now!

Ned Murphy
Legend
November 8, 2009

You're welcome