Provides optional percentage sizing for children of containers that use VerticalLayout.

Events:

openfl.events.Event.CHANGE

Dispatched when a property of the layout data changes, which triggers the container to invalidate.

Available since

1.0.0

.

See also:

Static methods

staticfill():VerticalLayoutData

Creates VerticalLayoutData that fills the parent container, with the percentWidth and percentHeight both set to 100.0.

In the following example, one of the container's children fills the container's bounds:

var container = new LayoutGroup();
container.layout = new VerticalLayout();

var child = new Label();
child.layoutData = VerticalLayoutData.fill();
container.addChild(child);
Available since

1.0.0

.

See also:

@:value({ percentWidth : 100.0 })staticfillHorizontal(percentWidth:Float = 100.0):VerticalLayoutData

Creates VerticalLayoutData that fills the width of the parent container, with the ability to optionally specify a percentage value to pass to percentWidth.

In the following example, one of the container's children fills the container's width:

var container = new LayoutGroup();
container.layout = new VerticalLayout();

var child = new Label();
child.layoutData = VerticalLayoutData.fillHorizontal();
container.addChild(child);
Available since

1.0.0

.

See also:

@:value({ percentHeight : 100.0 })staticfillVertical(percentHeight:Float = 100.0):VerticalLayoutData

Creates VerticalLayoutData that fills the height of the parent container, with the ability to optionally specify a percentage value to pass to percentHeight.

In the following example, one of the container's children fills the container's height:

var container = new LayoutGroup();
container.layout = new VerticalLayout();

var child = new Label();
child.layoutData = VerticalLayoutData.fillHorizontal();
container.addChild(child);
Available since

1.0.0

.

See also:

Constructor

new(?percentWidth:Float, ?percentHeight:Float)

Creates a new VerticalLayoutData object from the given arguments.

Available since

1.0.0

.

Variables

@:bindable("change")marginBottom:Null<Float>

Extra space, measured in pixels, that is inserted after this item in the layout.

This item's marginBottom value will be added to the layout's gap value and the next item's marginTop value to create the total space between items. If this is the last item in the layout, nothing will be added too the marginBottom value.

Negative values are allowed for the margins.

Available since

1.1.0

.

See also:

@:bindable("change")marginTop:Null<Float>

Extra space, measured in pixels, that is inserted before this item in the layout.

This item's marginTop value will be added to the layout's gap value and the previous item's marginBottom value to create the total space between items. If this is the first item in the layout, nothing will be added to the marginTop value.

Negative values are allowed for the margins.

Available since

1.1.0

.

See also:

@:bindable("change")percentHeight:Null<Float>

The height of the layout object, as a percentage of the parent container's height.

A percentage may be specified in the range from 0.0 to 100.0. If the value is set to null, this property is ignored and the standard height in pixels will be used.

The parent container will calculate the sum of all of its children with explicit pixel heights, and then the remaining space will be distributed to children with percent heights. Additionally, if the total sum of percentHeight values exceeds 100.0, all percentHeight values will be normalized to the range from 0.0 to 100.0.

In the following example, the height of a container's child is set to 50% of the container's height:

var container = new LayoutGroup();
container.layout = new VerticalLayout();

var percentages = new VerticalLayoutData();
percentages.percentHeight = 50.0;

var child = new Label();
child.layoutData = percentages;
container.addChild(child);
Available since

1.0.0

.

@:bindable("change")percentWidth:Null<Float>

The width of the layout object, as a percentage of the parent container's width.

A percentage may be specified in the range from 0.0 to 100.0. If the value is set to null, this property is ignored.

Tip: If all children of the same container will have the percentWidth value set to 100.0, it's better for performance to set VerticalLayout.horizontalAlign to HorizontalAlign.JUSTIFY instead.

In the following example, the width of a container's child is set to 50% of the container's width:

var container = new LayoutGroup();
container.layout = new VerticalLayout();

var percentages = new VerticalLayoutData();
percentages.percentWidth = 50.0;

var child = new Label();
child.layoutData = percentages;
container.addChild(child);
Available since

1.0.0

.