我早cocosStudio中画了两个button ,但是在获取这两个button失败。
提示如下:LUA ERROR: :242: attempt to index local 'button_confirm' (a nil value)
我仔细查看了,导出的工程里的Exportjson文件。有这两个button,
这个是我的代码:
local mywidget = ccs.GUIReader:getInstance():widgetFromJsonFile("SanGuoS_4/SanGuoS_4.ExportJson")
local dialogLayer = cc.Layer:create()
dialogLayer:addChild(mywidget)
local myroot = dialogLayer:getChildByTag(69)
local button_confirm = myroot:getChildByTag(76)
local button_cancel = myroot:getChildByTag(78)
用getChildByName也不对