簡體   English   中英

單擊AS3上另一個動畫片段中的動畫片段

[英]Clicking on a movieclip inside another movieclip on AS3

好吧,我需要的很簡單,但是它使我發瘋,我想知道AS3是否在動畫片段中檢測到我的鼠標。 例如,我有一個影片剪輯實例“ BEframes”,它位於影片剪輯“ BE1”內,我想將他放置在一個新的影片剪輯實例“ roll”內。 因此順序為:卷> BE1> BEframes。 我想知道閃光燈是否只會檢測“滾動”,否則他將檢測所有電影剪輯,謝謝,

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");
}

*

可能應該使用MOUSE_OVER和MOUSE_OUT代替ROLL_OVER和ROLL_OUT。

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

為了避免為movieClips接收mouseEvent,請將mouseEnabled設置為false,即,如果您不想剪輯片段的鼠標事件,請將roll.mouseEnabled = false設置為以下對象將接收mouseEvent

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM