A Curious Animal
Bla, bla, bla, ..., (evolution) , ..., blog, blog, blog, ...
Bla, bla, bla, ..., (evolution) , ..., blog, blog, blog, ...
Tue, 22 Dec, 2009
Recently I was working on a AS3 project and surprisingly the handler assigned on a Sprite subclass for mouse DOUBLE_CLICK events never is fired.
If you arrive here and are in the same situation like me, then the next link is for you: http://actionscript3.blogs2k.com/2009/01/17/ActionScript%203%20-%20no-double-click-at-all%20-AS3.
If you go to first comment you could read that:
In order for the DOUBLE_CLICK event to be captured, the MovieClip, or Sprite in this case, you must first have the doubleClickEnabled property set to true.
Take also into account probably you must play too with the 'mouseChildren' property and that could be a problem when you work with some kind of scene graph objects.
Finally I would like to note one of the solutions commented to emulate the double click using simple the click event and getTimer().
const CLICK_TIME:int = 300;
var doubleTimer:int;
addEventListener(MouseEvent.CLICK, handleMouseClick);
function handleMouseClick(e:MouseEvent):void {
if (e.type == MouseEvent.CLICK) {
if (getTimer() - doubleTimer < CLICK_TIME) {
// execute code or dispatch event here
}
doubleTimer = getTimer();
}
}
Recent comments
7 weeks 3 days ago
14 weeks 5 days ago
1 year 14 hours ago
1 year 20 weeks ago
1 year 20 weeks ago