appendLayerAsync(layer, callback)


Function to add a layer in the specified destination layer using a separate, parallel thread. Appending a layer in a separate thread can be necessary if the layer is too big to be added in a short time. The layer to be inserted and the destination layer are both determined by their Layer objects. You can use getLayer or findLayers to determine the layer to be inserted. For example, this.parent determines the parent layer of the script module as destination layer. The new layer will be added behind the existing layers. To insert a layer at a specific position in the destination layer, use insertLayer or insertLayerAsync instead. The function returns a LoadProgress object that can be used to monitor the load progress. After the layer is added, the callback function is called. The callback function gets the LoadProgress object as default argument.

An Element object can only have one parent. It cannot be child of multiple parents. Therefore, an element object that you retrieved from the running plug-in instance must be removed before it can be inserted again. The element objects you retrieve through loadPreset or loadPresetAsync can be inserted freely, because these functions create a copy of the Element objects when reading them.

Available in: Controller.


layerThe Layer object of the layer that you want to append.Layer
callbackCallback function that is called when the layer is added. The callback function gets the LoadProgress object as argument.function, optional

Return Values

Returns a LoadProgress object.


See Also: appendBusappendEffectappendLayer, appendMidiModuleappendZone, LoadProgress