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.
thank you!!!
Thank you !
The second tip really made the get out a rut
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.
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!
@ 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.
Thanks for the tip – that second one would’ve confounded me without your help!
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.
YES !!! Thank you !!! I have this problem since 2 or 3 month … You are my saviour !!!
lol it just seemed so logical not to have to declare something like this. Thanks for stating the obvious.
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.
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.
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.
Thank you. Took less than 5 minutes to get everything working due to your post.
Keep it up.
thank U!!
Thanks!