Posted By

coprolit on 01/26/11


Tagged

actionscript flash as3 MouseEvent mouseChildren doubleClickEnabled


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

burnandbass
kure69


to get double click working on a Sprite/MovieClip with dynamic content


 / Published in: ActionScript 3
 

If content is added dynamically inside a button object on runtime, the content seems to 'override' the double click mouse event of the container button. Solution is to set mouseChildren = false for the button object.

  1. button.buttonMode = true;
  2. button.mouseChildren = false;
  3. button.doubleClickEnabled = true;
  4.  
  5. button.addEventListener( MouseEvent.DOUBLE_CLICK, doubleClickHandler );
  6.  
  7. // button content gets added/loaded...

Report this snippet  

You need to login to post a comment.