timeline.addNewLayer()

Availability

Flash MX 2004.

Usage

timeline.addNewLayer([name] [, layerType [, bAddAbove]]) 

Parameters

name
A string that specifies the name for the new layer. If you omit this parameter, a new default layer name is assigned to the new layer (“Layer n,” where n is the total number of layers). This parameter is optional.

layerType
A string that specifies the type of layer to add. If you omit this parameter, a “Normal” type layer is created. This parameter is optional. Acceptable values are "normal", "guide", "guided", "mask", "masked", and "folder".

bAddAbove
A Boolean value that, if set to true (the default), causes Flash to add the new layer above the current layer; false causes Flash to add the layer below the current layer. This parameter is optional.

Returns

An integer value of the zero-based index of the newly added layer.

Description

Method; adds a new layer to the document and makes it the current layer.

Example

The following example adds a new layer to the timeline with a default name generated by Flash:

fl.getDocumentDOM().getTimeline().addNewLayer();

The following example adds a new folder layer on top of the current layer and names it Folder1:

fl.getDocumentDOM().getTimeline().addNewLayer("Folder1", "folder", true);