Name
InsertLayer -- insert a new layer (V1.5)
Synopsis
InsertLayer(pos, type, id, x, y[, hidden])
Function
This function inserts a new layer of the object type specified by type and the object id specified by id into layer position pos. All the following layers will be moved downwards and therefore they will get a new id. The new layer will also be displayed at the position specified by x and y. If you specify 0 as pos, the layer will be inserted as the last layer.

The following object types are currently supported:

#BRUSH
Inserts the brush specified by id at x, y

#TEXTOBJECT
Inserts the text object specified by id at x, y

#ANIM
Inserts the anim specified by id at x, y (V2.0)

#VIDEO
Inserts the video specified by id at x, y (V6.0)

Starting with Hollywood 1.9 you can specify the optional argument hidden, which will insert a hidden layer which you can bring to front using ShowLayer() or ShowLayerFX().

You need to enable layers before you can use this function. See Layers introduction for details.

Inputs
pos
desired position for the layer or 0 for last layer
type
type of the object to be inserted (see list above)
id
identifier of the object to be inserted
x
x-position for the new layer
y
y-position for the new layer
hidden
optional: True if the layer shall be hidden (defaults to False) (V1.9)
Example
EnableLayers()
SetFillStyle(#FILLCOLOR)
Box(0, 0, 100, 100, #RED)
Circle(#CENTER, #CENTER, 50, #BLUE)
TextOut(#RIGHT, #BOTTOM, "Hello World")
InsertLayer(1, #BRUSH, 1, #CENTER, #CENTER)
The code above inserts brush 1 as the first layer. This means that all the other layers will be re-positioned. The red rectangle will get layer position 2 now (was layer 1), the blue circle will be layer 3 (was layer 2) and the "Hello World" text will be layer 4 (was layer 3).

Show TOC