如果一个MC,里面只有Shape(一个或则多个均可),没有其他MC,那么只要设置它的doubleClickEnabled属性为true,它可以很正常地接收DOUBLE_CLICK事件。那么,现在的问题是这样的:有这样一个MC,假设其实例名称为parentMC,里面含有一个或多个MC,继续假设其中有一个名称为aMC,那么当设置parentMC的doubleClickEnabled属性为true时,它并不可以接收DOUBLE_CLICK事件,但是如果设置其中的aMC的doubleClickEnabled属性为true时,他们都可以接收DOUBLE_CLICK事件。更为奇怪的是,如果你同时为parentMC和aMC添加DOUBLE_CLICK事件侦听,当双击时居然会触发两个DOUBLE_CLICK事件!
无法接收DOUBLE_CLICK事件的代码:
parentMC.doubleClickEnabled = true;
parentMC.addEventListener(MouseEvent.DOUBLE_CLICK, DoubleClickHandler);function DoubleClickHandler(event:MouseEvent)
{
trace(“double click”);
}
正常接收DOUBLE_CLICK事件的代码:
parentMC.aMC.doubleClickEnabled = true;
parentMC.aMC.addEventListener(MouseEvent.DOUBLE_CLICK, DoubleClickHandler);function DoubleClickHandler(event:MouseEvent)
{
trace(“double click”);
}
同时触发两个DOUBLE_CLICK事件的代码:
parentMC.doubleClickEnabled = true;
parentMC.addEventListener(MouseEvent.DOUBLE_CLICK, DoubleClickHandler);parentMC.aMC.doubleClickEnabled = true;
parentMC.aMC.addEventListener(MouseEvent.DOUBLE_CLICK, DoubleClickHandler);function DoubleClickHandler(event:MouseEvent)
{
trace(“double click”);
}