标签:ui cocostudio 控件 cocos2d-js
settingScene = ccs.load(res.setting_json).node;
2、在当前层中加入改节点。
this.addChild(settingScene);
3、通过ccui.helper.seekWidgetByName(node,name)获得控件
musicSlider = ccui.helper.seekWidgetByName(settingScene, "musicSlider");
4、通过addCCSEventListener监听事件(sender,type)
musicSlider.addCCSEventListener(this.sliderStateChange);
5、不同的控件监听事件的时候type不同
ccui.Slider.EVENT_PERCENT_CHANGED可以得到的数据:
sender.getPercent()
(2)buttonswitch (type) {(3)TextField
case ccui.Widget.TOUCH_BEGAN:
break;
case ccui.Widget.TOUCH_MOVED:
break;
case ccui.Widget.TOUCH_ENDED:
break;
case ccui.Widget.TOUCH_CANCELED:
break;
default:
break;
}
switch (type) {(4)checkbox
case ccui.TextField.EVENT_ATTACH_WITH_IME:
break;
case ccui.TextField.EVENT_DETACH_WITH_IME:
break;
case ccui.TextField.EVENT_INSERT_TEXT:
break;
case ccui.TextField.EVENT_DELETE_BACKWARD:
break;
default:
break;
}
switch (type) {
case ccui.CheckBox.EVENT_SELECTED:
break;
case ccui.CheckBox.EVENT_UNSELECTED:
break;
default:
break;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
cocos2d-js的UI用cocoStudio结合开发笔记
标签:ui cocostudio 控件 cocos2d-js
原文地址:http://blog.csdn.net/wuweitiandian/article/details/46988933