我动态添加了动画片段。有时,我会绘制动画片段并将位图放置在MC内的MC中,并向其中添加“添加”滤镜。稍后,我将“拖动”功能赋予此类父影片剪辑。我希望鼠标检测除绘制的位图以外的所有内容。我已经有包含位图设置为mouseEnabled false和mouseChildren false的动画片段。但是,鼠标仍然可以检测到位图。当我将父级设置为mouseEnabled = false时,父级不再拖动,因此不起作用。当我将父级设置为mouseChildren = false时,什么都没有改变,位图仍然被检测到。如何使绘制的位图保持可见状态,但使拖动功能忽略MC封装的位图?
答案 0 :(得分:2)
因此,经过一番讨论,我们得出以下结论:
在解决收集对象的类的过程中,解决方案也非常简单。
// We are in the root here.
addEventListener(MouseEvent.MOUSE_DOWN, onDown);
function onDown(e:MouseEvent):void
{
var aPoint:Point = localToGlobal(new Point(mouseX, mouseY));
var aList:Array = getObjectsUnderPoint(aPoint);
// Lets browse through all the results.
for each (var aChild:DisplayObject in aList)
{
// How to find if an object is an instance of certain Class.
if (aChild is Shape)
{
trace("A Shape was found under a name of", aChild.name, "!!!");
}
}
}