Wednesday, September 12, 2007

double click problems

Let's say we want to set up a standard doubleClick interaction on a movie-clip(draw a square inside this clip) with instance name square:

square.doubleClickEnabled=true;
square.addEventListener(MouseEvent.DOUBLE_CLICK,double);
function double(event:MouseEvent):void {
trace("doubleclick");
}


Compile, it should work fine - "doubleclick" should trace when you double click the square.

Now place a movie-clip inside square with instance name circle(draw a circle inside this clip).

Recompile. Notice that double-click isn't recognised if you double click on the circle...

For some reason the circle movieClip is preventing the double-click event from bubbling up to square. forcing 'circle' to ignore the double-click and allow the event to continue on its merry way to 'square' is the best solution i have found:


square.circle.mouseEnabled=false;

No comments: