Laya|Laya Panel

Panel里放很多BOX,这些BOX的内容是动态变化的,可以在代码里返回每一个BOX的高度,然后动态处理布局,最后调用refresh刷新即可。

var heights : Array = []; heights.push(TreasureStatusHelper.updateAttrs(this, _treasureVo)); heights.push(TreasureStatusHelper.updateRefine(this, _treasureVo)); heights.push(TreasureStatusHelper.updateAssociation(this, _treasureVo)); heights.push(TreasureStatusHelper.updateDesc(this, _treasureVo)); var tempY : Number = 0; for (var i : int = 0; i < heights.length; i++) { this["Image_scroll_con" + (i + 1)].y = tempY; tempY += heights[i] + CONTENT_PADDING; } Panel_scroll.refresh();

【Laya|Laya Panel】注意,在返回高度前,需要将这个BOX的高度也设置一下,否则在滚动时会出现空白。
bg.height = labY + _nodeTianfu.y + 10; trace("bg.height",bg.height); trace("m.Image_scroll_con6",m.Image_scroll_con6.height); m.Image_scroll_con6.height = bg.height; return bg.height;

    推荐阅读