当通过主时间轴中的图层输入以下代码时,gotoAndPlay 不起作用,并且所有标签都是正确的。
this.moveRight.addEventListener("click", function (e) {
alert("called");
//gotoAndPlay("lblSlide2"); // Output - ReferenceError: gotoAndPlay is not defined
//this.gotoAndPlay("lblSlide2"); // Output - Is not a function.
//MovieClip(parent).this.gotoAndPlay("lblSlide2"); // Output - ReferenceError: MovieClip is not defined
//MovieClip(this.parent).gotoAndPlay("lblSlide2"); // Output - ReferenceError: MovieClip is not defined
});
//this.gotoAndPlay("lblSlide2"); // Works
出了什么问题?
最佳答案
我发现在这个问题上使用解决方案取得了成功:Flash HTML5 canvas fl_MouseOverHandler
对于您的场景,我相信应用程序将如下所示:
this.moveRight.addEventListener("click",moveRightClick.bind(this));
function moveRightClick(){
this.gotoAndPlay("lblSlide2");
};
所以不要使用匿名函数,声明它,然后添加 .bind(this) 为其提供作用域。
关于javascript - Adobe Flash Professional CC - HTML5 Canvas - 主时间轴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31843280/