0

所以就像标题所说的那样,我有一个过于简单的按钮(下面的代码),我看不出它不起作用的任何明显原因。当鼠标悬停在按钮上时,它应该进入“over”状态,当鼠标再次关闭时,它应该显示“normal”阶段。没什么特别的,但是每当我滚动按钮时,我都会在一秒钟内收到两条跟踪消息(我的光标不会离开按钮)。

我也试过了MouseEvent.MOUSE_OVERMouseEvent.MOUSE_OUT结果一样。

package  {

    import flash.display.MovieClip; 
    import flash.events.Event;
    import flash.events.MouseEvent;

    public class thisShouldWork extends MovieClip{

        public function thisShouldWork() {
            mouseChildren = false;
            this.addEventListener(MouseEvent.ROLL_OVER, handleMouseRollOver, false, 0, true);
            this.addEventListener(MouseEvent.ROLL_OUT, handleMouseRollOut, false, 0, true);
            this.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown, false, 0, true);
        }

        protected function handleMouseRollOver(event:MouseEvent):void{
            trace("OVER" + event.currentTarget);
            gotoAndStop("over");
        }
        protected function handleMouseRollOut(event:MouseEvent):void{
            trace("NORMAL");
            gotoAndStop("normal");
        }
        protected function handleMouseDown(event:MouseEvent):void{
            trace("DOWN");
            gotoAndStop("down");
        }
    }
}
4

0 回答 0