05 May 2009 ~ 15 Comments

Flash AS3 – Double Click Not Working

There are 2 secrets to get double click working in AS3. The first one is not really a secret if you read the documentation. The second one had me scratching my head for a few hours. So here they are:

1. set doubleClickEnabled to true


button.doubleClickEnabled = true;
button.addEventListener( MouseEvent.DOUBLE_CLICK, doubleClickHandler );

2. You must set the doubleClickEnabled to any MovieClips inside the Button/MovieClip listening for the double click event. If the MovieClip/Button contains only shapes or text that’s fine, the double click will work without the second step.

15 Responses to “Flash AS3 – Double Click Not Working”

  1. joey 8 July 2009 at 3:16 pm Permalink

    thank you!!!

  2. Rommel 3 August 2009 at 5:06 am Permalink

    Thank you ! :D The second tip really made the get out a rut :D

  3. PruthviRaj 15 August 2009 at 6:38 am Permalink

    Thank You!! The second tip really saved my life…. “If the MovieClip/Button contains only shapes or text that’s fine, the double click will work without the second step.”
    It works only for static text, not for dynamic text box, we have to assign “doubleClickEnabled” for dynamic text box also, if the movieClip contains dynamic text. :)

  4. dan 5 January 2010 at 5:25 pm Permalink

    What a pain in the ass, I have a ton of movieclips and dynamic text fields in these dynamically created and placed MCs, and I’m guessing if there’s more clips nested in those, they’ll need doubleClickEnabled too. So I could write 25 copypastas of the same damn line, or some crazy recursive function to to enable all this…

    Instead I’m going to use a timer to check time between clicks on the clips.

    This reminds me of crappy hacks from flash 4!

  5. Philleep Florence 2 March 2010 at 5:55 pm Permalink

    @ Dan (01/05/2010)
    You don’t have to enter listerners for all child items, try the following:

    clickItem.buttonMode = true;
    clickItem.doubleClickEnabled = true;
    clickItem.mouseChildren = doubleClickEnabled;

    It works for me.

  6. Scott 29 April 2010 at 5:11 am Permalink

    Thanks for the tip – that second one would’ve confounded me without your help!

  7. Ico Penchev 7 September 2010 at 12:31 am Permalink

    If you set the “mouseChildren” property of the object to “false” you won’t have to enable double click for all of the object’s children.

  8. Berny 8 October 2010 at 5:39 am Permalink

    YES !!! Thank you !!! I have this problem since 2 or 3 month … You are my saviour !!!

  9. chris 6 November 2010 at 6:03 am Permalink

    lol it just seemed so logical not to have to declare something like this. Thanks for stating the obvious.

  10. LOLOLO 31 January 2011 at 8:09 am Permalink

    Hi, thanks!

    Note that this statement isn’t valid (anymore?):
    “If the MovieClip/Button contains only shapes or text that’s fine, the double click will work without the second step.”

    Using FlashDevelop 3 with Flex’s compiler.

  11. Darrell 7 April 2011 at 3:33 am Permalink

    Heya i am for the primary time here. I came across this board and I to find It truly helpful & it helped me out a lot. I am hoping to provide one thing again and help others such as you aided me.

  12. antyrama 16 May 2011 at 3:33 pm Permalink

    Pretty component to content. I just stumbled upon your blog and in accession capital to say that I acquire actually loved account your blog posts. Anyway I will be subscribing to your feeds and even I fulfillment you get right of entry to persistently quickly.

  13. Vash the Stampede 7 June 2011 at 8:10 am Permalink

    Thank you. Took less than 5 minutes to get everything working due to your post.

    Keep it up.

  14. JOJO 23 October 2011 at 2:22 am Permalink

    thank U!!

  15. Manuel Lama 4 March 2012 at 6:42 am Permalink

    Thanks!


Leave a Reply