Cocos2d iphone 无法读取未定义的-ccui.Button的属性“setTitleText”
我无法为ccui.Button设置标题文本一个小部件,它的显示无法读取Cocos2d JS中未定义的属性“setTitleText” 这是密码Cocos2d iphone 无法读取未定义的-ccui.Button的属性“setTitleText”,cocos2d-iphone,cocos2d-js,cocos2d-html5,Cocos2d Iphone,Cocos2d Js,Cocos2d Html5,我无法为ccui.Button设置标题文本一个小部件,它的显示无法读取Cocos2d JS中未定义的属性“setTitleText” 这是密码 SolutionGrid.setEmptySolutionBox = function(selChild,rChar) { selChild.active = true; cc.log("get tag of empty solutionBpx" + selChild.getTag()); var textButtons
SolutionGrid.setEmptySolutionBox = function(selChild,rChar) {
selChild.active = true;
cc.log("get tag of empty solutionBpx" + selChild.getTag());
var textButtons = ((ccui.Button)(selChild.getChildByTag(5)));
//var textButtons = ccui.Button(selChild.getChildren()[0]);
if(textButtons===null){
cc.log("get tag of empty solutionBpx NULL");
}
///cc.log("get tag of empty solutionBpx" + textButtons.getTag());
textButtons.setTitleText("a");
};
其中selChild是添加ccui.按钮的节点
这里是如何添加的,我正在获取该节点的标记,但找不到作为其子节点的ccui.Button
solBox.addChild(textButton,5,5); //solBox is CCNode and text button is ccui.Button
改变
与
什么是ccui?它在哪里声明、初始化?@learncos2D:ccui.按钮是。。它是初始化的,即textButton,我刚刚给出了一个片段,并添加为带有标记5的节点solBox的子节点
var textButtons = ((ccui.Button)(selChild.getChildByTag(5)));
var textButtons = selChild.getChildByTag(5);