示例语言:AS3
//创建子元素
var _worldLeftItem:ChatLeftItem = new ChatLeftItem();
//设置子元素居中
_worldLeftItem.centerX=0.5;
//重点:设置子元素的y周
_worldLeftItem.y=_ui.worldItemPanel.contentHeight;
//添加到Panel
_ui.worldItemPanel.addChild(_worldLeftItem);
重点1:contentHeight获取面板的内容高度
_ui.worldItemPanel.contentHeight
重点2:通过内容高度设置下一个子元素的y轴,防止子元素重叠
_worldLeftItem.y=_ui.worldItemPanel.contentHeight;











网友评论