用例子的创建方法创建了一个pageView,但是为什么addEventListener回调不到翻页的函数?求解!
var pageView = new ccui.PageView();
pageView.setTouchEnabled(true);
pageView.setContentSize(cc.size(240, 130));
pageView.x = 100;
pageView.y = 300;
for (var i = 0; i < 3; ++i) {
var layout = new ccui.Layout();
layout.setContentSize(cc.size(240, 130));
var layoutRect = layout.getContentSize();
// var imageView = new ccui.ImageView();
// imageView.setTouchEnabled(true);
// imageView.setScale9Enabled(true);
// imageView.loadTexture("ccs-res/cocosui/scrollviewbg.png");
// imageView.setContentSize(cc.size(240, 130));
// imageView.x = layoutRect.width / 2;
// imageView.y = layoutRect.height / 2;
// layout.addChild(imageView);
var text = new ccui.Text();
text.string = "page" + (i + 1);
text.font = "30px 'Marker Felt'";
text.color = cc.color(192, 192, 192);
text.x = layoutRect.width / 2;
text.y = layoutRect.height / 2;
layout.addChild(text);
pageView.insertPage(layout,i);
}
PrivilegeNode.addChild(pageView);
pageView.addEventListener(this.pageViewEvent.bind(this));
pageViewEvent: function(pageView, type){
switch (type){
case ccui.PageView.EVENT_TURNING:
cc.log(" pageView.getCurPageIndex === " + pageView.getCurPageIndex());
break;
default:
break;
}
},