簡體   English   中英

如何在Adobe Flash AS 3.0中將鼠標懸停在gotoAndPlay上

[英]How to gotoAndPlay on mouseover in Adobe Flash AS 3.0

在Adobe Flash CC 3.0中,我嘗試在場景內的鼠標懸停時添加gotoAndPlay函數。

我把這段代碼:

this.stop();
this.addChild(overBtn);
this.overBtn.addEventListener("mouseover", function (event)
{
        this.gotoAndPlay(17);    
});

但是它不起作用,我在做什么錯?

添加事件偵聽器的語法是

<target>.addEventListener(<Event>,<function>);

stage.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);

然后,您將在其他地方具有以下功能:

private function mouseOver(me:MouseEvent):void{
    goToAndPlay(17);
}

用於訪問處理的對象,在事件監聽器中執行此操作

this.stop();
this.addChild(overBtn);
overBtn.addEventListener("mouseover", function (event)
{
        event.target.gotoAndPlay(17);
});

暫無
暫無

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

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