![](/img/trans.png)
[英]Flash AS3.0 - Error 1180 Call to a possibly undefined method 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.