cocos版本v2.3.3.0
–自定义控件脚本
local container = {}
function container.CreateCustomNode()
local rootNode = cc.Node:create()
return rootNode
end
function container.GetBaseType()
return ‘Node’
end
function container.DoSomeThing(root, parm)
local parent = root:getParent()
local childstr = ""
local children = parent:getChildren()
if children then
for k, child in pairs(children) do
if (child) then
childstr = childstr.."name = "..child:getName().."\n"
end
end
end
end
把自定义控件拖入场景后 想获得父节点的其他子节点信息(container.DoSomeThing(root))
但是 getName 取出来全为空字符串 getTag取出来全为999999 而getPosition则正确