I want to add to custom MovieClip MouseEvent listener. MovieClip contains some text. When pressing on the part of MovieClip that contains text, listener does not react. How can I change that? I want the whole MovieClip to be clickable. Thank you开发者_JAVA技巧 in advance.
MovieClip has a property mouseChildren, which means that every event is send only to this container, and not to it's child elements: myMovieClip.mouseChildren = false;
package
{
    import flash.display.Sprite;
    import com.*;
    import flash.text.TextField;
    import flash.events.MouseEvent;
    public class Chk extends Sprite
    {
        private var ba:Ball;
        private var txt:TextField;
        public function Chk():void
        {
            ba=  new Ball(50, 0xf0fff00, 1);
            txt = new TextField();
            txt.text = "HI";
            ba.addChild(txt);
            addChild(ba);
            ba.buttonMode = true;
            ba.mouseChildren = false;
            ba.x = stage.stageWidth/2;
            ba.y = stage.stageWidth/2;
            ba.addEventListener(MouseEvent.CLICK, action);
        }
        private function action(e:MouseEvent):void
        {
            trace("clicked");
        }
    }
}
.......
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论