Buttons created from cocos studio ui editor are not working

Buttons created from cocos studio ui editor are not working
0.0 0


for some reason cocos studio ui editor created buttons are not working for me.

here is what i did,
#1, create a test ui page with only one button use cocos studio ui editor, (i had “Touchable” selected)
#2, load json from my scene
this.*uiLayer = ccs.UILayer.create;
this.addChild(this.*uiLayer, 100);
this.*widget = ccs.GUIReader.getInstance().widgetFromJsonFile(“xxx.json”);

testCallback:function(sender, type) {
cc.log(“button clicked”);

for some reason, testCallback function almost never get triggered (I had it happened twice after millions of tries)


hi,JL Li.
Did you preload your render resource? Because the size of button will equal 0 when the render resource is not preloaded.
Thanks for your feedback.


shouldn’t the widgetfromjsonfile() function load it automatically? coz the button image is rendered on my screen, I can see it is there.
but I did not preload json and its resource files before I use it.


Try making TouchGroup and addChild your widget to that.


Thanks growingdever!!

Create TouchGroup and use “addWidget()” insted of “addChild()” to add widgets to the TouchGroup
is works for me!!