Posted By

coprolit on 01/26/11


actionscript flash as3 MouseEvent mouseChildren doubleClickEnabled

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


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;
  5. button.addEventListener( MouseEvent.DOUBLE_CLICK, doubleClickHandler );
  7. // button content gets added/loaded...

Report this snippet  

You need to login to post a comment.