我已经在场景中设置了一个按钮,希望把脚本Button a挂到这个按钮上,实现点击4次 文本框变化4次,但始终报错(这已经是我最大程度修改了)
// Button a
cc.Class({
extends: cc.Component,
properties: {
atext:‘a:’,
i : 0,
a : cc.string[‘回应1’,‘回应2’,‘回应3’,‘回应4’],
},
onLoad: function () {
this.node.getChildByName(“labela”).string = this.atext;
},
buttona:function(){
this.node.getChildByName(“labela”).string = a[i]
i++;
},
});