VerticalDistributedLayout class may be used to position the children of a container from top to bottom, in a single column — where the total height of the container is distributed equally to the heights of each child. In other words, each child will have the same height, and their sum is equal to the total height of the container.
var container = new LayoutGroup(); this.addChild(container); var child1 = new Button(); child1.text = "One"; container.addChild(child1); var child2 = new Button(); child2.text = "Two"; container.addChild(child2); var child3 = new Button(); child3.text = "Three"; container.addChild(child3);
container.layout = new VerticalDistributedLayout();
By default, the first child will be positioned in the top-left corner. Each additional child will be positioned below the previous child — creating a single, vertical column.
The following sections will introduce a number of properties that may be used to adjust the positioning and sizing of children in the layout.
layout.paddingTop = 10.0; layout.paddingRight = 15.0; layout.paddingBottom = 10.0; layout.paddingLeft = 15.0;
gap refers to the space, measured in pixels, between each child in the container.
layout.gap = 5.0;