上一节中讲了如何加载cocostudio的UI文件(参考:
cocos2d-x的lua脚本如何加载Cocostudio制作的UI文件)
那么我们如何获取UI上的控件呢?答案是通过Name或Tag查找,使用函数getChildByName() 或 getChildByTag()。
以Button为例,代码如下:
local function
createCocostudioUI()
&nb
本文介绍了在cocos2d-x的lua脚本中如何通过Name或Tag获取Cocostudio创建的UI控件,以Button为例,展示了使用getChildByName()和getChildByTag()函数的代码示例。

被折叠的 条评论
为什么被折叠?