
需要把函数写在前面,否则,后面调用的时候会说无法找到该函数,lua中提示函数为nil....
--响应事件函数
localfunctionselectedEvent(sender,eventType)
ifeventType== ccui.CheckBoxEventType.selectedthen
cclog("eventType == ccui.CheckBoxEventType.selected "elseifeventType== ccui.CheckBoxEventType.unselected cclog("ccui.CheckBoxEventType.unselected unselected "end
end
--创建复选框
localcheckBox= ccui.CheckBox:create()
checkBox:settouchEnabled(true)
checkBox:loadTextures("check_Box_normal.png",
"check_Box_normal_press.png""check_Box_active.png""check_Box_normal_disable.png""check_Box_active_disable.png")
checkBox:setposition(cc.p(120,300))--坐标
checkBox:addEventListenerCheckBox( selectedEvent) --注册事件 layerFarm:addChild(checkBox,10) -- 添加到图层 总结以上是内存溢出为你收集整理的cocos2dx 3.X Lua复选框的用法ccui.CheckBox全部内容,希望文章能够帮你解决cocos2dx 3.X Lua复选框的用法ccui.CheckBox所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)