//初始化
initScrollView() {
//获取当前用户才学数量
// this.scholarshipLabel.string = "<color=#975F22>×</c><color=#975F22>"+ AppMain.instance.scholarshipCount +"</color>";
this.scholarshipLabel.string = "<color=#975F22>×</c><color=#975F22>"+ 100 +"</color>";
this.content = this.scrollView.content;
this.content.height = 36/3*(223+15)+15+25;
for(var i = 0; i < 36; i++){
let item = cc.instantiate(this.catItemPrefab);
this.content.addChild(item);
item.on('mousedown', function (event) {
console.log('Mouse down');
}, this);
// this.bindClickEvent(item.getComponent(cc.Button),i);
// let yItem = -i * (18+93) - 93 / 2 + 320;
// item.setPosition(0, yItem);
}
// for(var i = 0; i < 36; i++){
var choose = this.content.children[0];
choose.getChildByName("bg").color = cc.color(255,237,206,255);
choose.getChildByName("costNum").active = false;
choose.getChildByName("exchangeBg").active = true;
// }
},
showCatBtn(){
cc.log("显示")
// this.catShowNode.active = true;
},
准备用cocos creator写一个物品栏,给scrollView中给子节点添加点击事件,但是无效,不知道什么情况。麻烦了解的指导一下