Name
SetLayerName -- assign a layer name (V2.0)
Synopsis
SetLayerName(id, name$)
Function
You can use this function to assign a name to the layer specified by id. This is very useful if you have multiple layers whose identifiers change constantly (e.g. because you frequently remove and add layers). If you give your layers names, you do not have to worry about on which position the layer currently resides. You can easily access it by just using its name. All functions which accept layer id's, will also accept names.

Please note that the name for the layer must be unique within the current background picture's layer cache. Layer names are case insensitive, i.e. "layer1" is the same layer as "LAYER1".

To find out which id a named layer currently occupies, you can use the #ATTRLAYERID attribute with the GetAttribute() command.

If you want to assign a name to the newest layer, simply pass 0 and Hollywood will automatically use the top layer. To remove a layer's name, pass an empty string in name$.

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

Inputs
id
identifier of the layer to be named or 0 for the last layer added
name$
desired name for the layer
Example
EnableLayers()
SetFillStyle(#FILLCOLOR)

Box(0, 0, 100, 100, #RED)      ; create layer 1
Box(50, 50, 100, 100, #GREEN)  ; create layer 2

SetLayerName(1, "redbox")      ; give them names
SetLayerName(2, "greenbox")    ; give them names

SwapLayers("redbox", "greenbox")  ; swap 'em! Now greenbox is layer 1
                                  ; and redbox is layer 2!

ShowLayer("redbox", #RIGHT, #BOTTOM)  ; move layer 2 to bottom-right
ShowLayer("greenbox", #LEFT, #TOP)    ; move layer 1 to top-left
You see that it is much easier to work with string names for layers instead of layer id's which are relative to the layer's position.

Show TOC