Construct 3 icon

Construct 3

Documentation

Layout script interface

Ashley's avatar
Medal
Construct Team Founder
Published 3 Jun, 2019
178 words
<1 min

The ILayout script interface represents a layout in the project.

Layout events

The following events can be listened for using the addEventListener method.

"beforelayoutstart"

"afterlayoutstart"

Fired when the layout starts. "beforelayoutstart" fires just before On start of layout, and "afterlayoutstart" first just after. In both events, all instances on the layout are created and available to modify.

Layout APIs

name

A read-only string of the layout name.

index

A read-only number of the zero-based index of the layout in the order it appears in the Project Bar.

addEventListener(eventName, callback)

removeEventListener(eventName, callback)

Add or remove a callback function for an event. See Layout events above for the available events.

getLayer(layerNameOrIndex)

Get an ILayer interface for a layer on the layout, by a case-insensitive string of its name or its zero-based index.

getAllLayers()

Return an array of ILayer interfaces representing all the layers on the layout.

width

height

Set or get the size of the layout. Note a layout cannot have a zero or negative size.

scrollTo(x, y)

Scroll to the given position in layout co-ordinates.