我必须将此代码执行103次,但我不能创建函数,因此我不必为每个按钮都编写函数(使用animate-cc + createjs)。
this.Box1.addEventListener("click", click1.bind(this));
function click1() {
this.parent.nombres.gotoAndStop(1);
}
this.Box2.addEventListener("click", click2.bind(this));
function click2() {
this.parent.nombres.gotoAndStop(2);
}
this.Box3.addEventListener("click", click3.bind(this));
function click3() {
this.parent.nombres.gotoAndStop(3);
}我很感谢你提前给予的帮助。
发布于 2020-04-25 17:50:24
您可以将其放入array,然后将其放入for或while循环中。
我也有同样的问题。我的脚本是生疏的,所以我不知道如何准确地编写脚本。
var buttons:Array = new Array(bnt1,bnt2,bnt3,bnt4,bnt5);但即使是这样,也可以被简化。
https://stackoverflow.com/questions/60355900
复制相似问题