有一个包含许多其他影片剪辑的主容器,在这些 CHILD1 影片剪辑中,也有一个 CUBE 和一个 IMAGE 影片剪辑。我只想禁用 IMAGE 影片剪辑的鼠标事件,可以吗?
CONTAINER
-CHILD1
-CUBE //this has mouse events!
-IMAGE //want to disable the mouse events for this!
-CHILD2
-CUBE //this has mouse events!
-IMAGE //want to disable the mouse events for this!
-CHILD3
-CUBE //this has mouse events!
-IMAGE //want to disable the mouse events for this!
任何的想法?谢谢!CHILD的代码块:
private function added(e:Event) {
removeEventListener(Event.ADDED_TO_STAGE, added);
addEventListener(MouseEvent.MOUSE_UP, NEXT);
}
public function NEXT(e:MouseEvent) {
//OB is the instance name of the IMAGE
if(e.target.name == "OB"){
e.stopImmediatePropagation();
return;
}
OB.gotoAndStop(Main.ID);
}
[已解决] 要禁用特定孩子的事件监听:
private function added(e:Event) {
mouseEnabled = false; //This is the clue.
OB.mouseEnabled = false;
OB.mouseChildren = false;
removeEventListener(Event.ADDED_TO_STAGE, added);
cube.addEventListener(MouseEvent.MOUSE_UP, NEXT);
}