【问题标题】:Clicking on a movieclip inside another movieclip on AS3在 AS3 上单击另一个影片剪辑中的影片剪辑
【发布时间】:2013-10-15 14:31:09
【问题描述】:

好的,我需要它很简单,但它让我发疯,我想知道 AS3 是否在影片剪辑中检测到我的鼠标。 例如,我有一个影片剪辑实例“BEframes”,它位于影片剪辑“BE1”内,我想将他放在一个新的影片剪辑实例“滚动”中。所以顺序是roll > BE1 > BEframes。 我想知道flash是只检测“滚动”还是检测所有的movieclips,谢谢,

for(i=1;i<=77;i++){
    var str:String =("BE" + i);
    this[str].BEframes.gotoAndStop(i);
    this[str].addEventListener(MouseEvent.CLICK, clique);
    this[str].addEventListener(MouseEvent.ROLL_OVER, over);
    this[str].addEventListener(MouseEvent.ROLL_OUT, out);
    }
function clique(evt:MouseEvent):void{
    var botao:String = evt.currentTarget.name.toString();
    var num:String = botao.replace("BE", "");
    parede_esquerda.gotoAndStop(num);
}
function out(evt:MouseEvent):void {
    evt.currentTarget.gotoAndPlay("out");
}`enter code here`
function over(evt:MouseEvent):void {
    evt.currentTarget.gotoAndPlay("over");
}

*

【问题讨论】:

    标签: actionscript-3 flash


    【解决方案1】:

    您可能应该使用 MOUSE_OVER 和 MOUSE_OUT 而不是 ROLL_OVER 和 ROLL_OUT。

    this[str].addEventListener(MouseEvent.MOUSE_OVER, over);
    this[str].addEventListener(MouseEvent.MOUSE_OUT, out);
    

    【讨论】:

      【解决方案2】:

      为了避免接收movieClips的mouseEvent,请将mouseEnabled设置为false,即如果您不希望剪辑滚动的鼠标事件设置roll.mouseEnabled = false,以便下面的对象将接收mouseEvent

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-09-23
        • 2018-01-13
        • 1970-01-01
        • 2014-08-28
        • 2017-06-24
        • 2015-07-07
        相关资源
        最近更新 更多