Layer
app.activeDocument.layers[index]
Description
Section titled “Description”A layer in an Illustrator document. Layers may contain nested layers, which are called sublayers in the user interface.
The layer
object contains all of the page items in the specific layer as elements.
Your script can access page items as elements of either the Layer object or as elements of the Document object. When accessing page items as elements of a layer, only objects in that layer can be accessed. To access page items throughout the entire document, be sure to refer to them as contained by the document.
Properties
Section titled “Properties”Layer.artworkKnockout
Section titled “Layer.artworkKnockout”app.activeDocument.layers[index].artworkKnockout
Description
Section titled “Description”Is this object used to create a knockout, and if so, what kind of knockout. You cannot set this value to KnockoutState.Unknown
.
Layer.blendingMode
Section titled “Layer.blendingMode”app.activeDocument.layers[index].blendingMode
Description
Section titled “Description”The mode used when compositing an object.
Layer.color
Section titled “Layer.color”app.activeDocument.layers[index].color
Description
Section titled “Description”The layer’s selection mark color.
Layer.compoundPathItems
Section titled “Layer.compoundPathItems”app.activeDocument.layers[index].compoundPathItems
Description
Section titled “Description”The compound path items contained in this layer.
CompoundPathItems; read-only.
Layer.dimPlacedImages
Section titled “Layer.dimPlacedImages”app.activeDocument.layers[index].dimPlacedImages
Description
Section titled “Description”If true
, placed images should be rendered as dimmed in this layer.
Boolean.
Layer.graphItems
Section titled “Layer.graphItems”app.activeDocument.layers[index].graphItems
Description
Section titled “Description”The graph items contained in this layer.
GraphItems; read-only.
Layer.groupItems
Section titled “Layer.groupItems”app.activeDocument.layers[index].groupItems
Description
Section titled “Description”The group items contained in this layer.
GroupItems; read-only.
Layer.hasSelectedArtwork
Section titled “Layer.hasSelectedArtwork”app.activeDocument.layers[index].hasSelectedArtwork
Description
Section titled “Description”If true
, an object in this layer has been selected; set to false
to deselect all objects in the layer.
Boolean.
Layer.isIsolated
Section titled “Layer.isIsolated”app.activeDocument.layers[index].isIsolated
Description
Section titled “Description”If true
, this object is isolated.
Boolean.
Layer.layers
Section titled “Layer.layers”app.activeDocument.layers[index].layers
Description
Section titled “Description”The layers contained in this layer.
Layers; read-only.
Layer.legacyTextItems
Section titled “Layer.legacyTextItems”app.activeDocument.layers[index].legacyTextItems
Description
Section titled “Description”The legacy text items in this layer.
LegacyTextItems; read-only.
Layer.locked
Section titled “Layer.locked”app.activeDocument.layers[index].locked
Description
Section titled “Description”If true
, this layer is editable; set to false to lock the layer.
Boolean.
Layer.meshItems
Section titled “Layer.meshItems”app.activeDocument.layers[index].meshItems
Description
Section titled “Description”The mesh items contained in this layer.
MeshItems; read-only.
Layer.name
Section titled “Layer.name”app.activeDocument.layers[index].name
Description
Section titled “Description”The name of this layer.
String.
Layer.nonNativeItems
Section titled “Layer.nonNativeItems”app.activeDocument.layers[index].nonNativeItems
Description
Section titled “Description”The non-native art items in this layer.
Layer.opacity
Section titled “Layer.opacity”app.activeDocument.layers[index].opacity
Description
Section titled “Description”The opacity of the layer.
Range: 0.0 to 100.0.
Number (double).
Layer.pageItems
Section titled “Layer.pageItems”app.activeDocument.layers[index].pageItems
Description
Section titled “Description”The page items (all art item classes) contained in this layer.
Layer.parent
Section titled “Layer.parent”app.activeDocument.layers[index].parent
Description
Section titled “Description”The document or layer that contains this layer.
Layer.pathItems
Section titled “Layer.pathItems”app.activeDocument.layers[index].pathItems
Description
Section titled “Description”The path items contained in this layer.
PathItems; read-only.
Layer.placedItems
Section titled “Layer.placedItems”app.activeDocument.layers[index].placedItems
Description
Section titled “Description”The placed items contained in this layer.
PlacedItems; read-only.
Layer.pluginItems
Section titled “Layer.pluginItems”app.activeDocument.layers[index].pluginItems
Description
Section titled “Description”The plug-in items contained in this layer.
PluginItems; read-only.
Layer.preview
Section titled “Layer.preview”app.activeDocument.layers[index].preview
Description
Section titled “Description”If true
, this layer should be displayed using preview mode.
Boolean.
Layer.printable
Section titled “Layer.printable”app.activeDocument.layers[index].printable
Description
Section titled “Description”If true
, this layer should be printed when printing the document.
Boolean.
Layer.rasterItems
Section titled “Layer.rasterItems”app.activeDocument.layers[index].rasterItems
Description
Section titled “Description”The raster items contained in this layer.
RasterItems; read-only.
Layer.sliced
Section titled “Layer.sliced”app.activeDocument.layers[index].sliced
Description
Section titled “Description”If true
, the layer item is sliced.
Default: false
.
Boolean.
Layer.symbolItems
Section titled “Layer.symbolItems”app.activeDocument.layers[index].symbolItems
Description
Section titled “Description”The symbol items contained in the layer.
SymbolItems; read-only.
Layer.textFrames
Section titled “Layer.textFrames”app.activeDocument.layers[index].textFrames
Description
Section titled “Description”The text art items contained in this layer.
TextFrameItems; read-only.
Layer.typename
Section titled “Layer.typename”app.activeDocument.layers[index].typename
Description
Section titled “Description”The class name of the referenced object.
String; read-only.
Layer.visible
Section titled “Layer.visible”app.activeDocument.layers[index].visible
Description
Section titled “Description”If true
, this layer is visible.
Boolean.
Layer.zOrderPosition
Section titled “Layer.zOrderPosition”app.activeDocument.layers[index].zOrderPosition
Description
Section titled “Description”The position of this layer within the stacking order of layers in the document.
Number (long); read-only.
Methods
Section titled “Methods”Layer.move()
Section titled “Layer.move()”app.activeDocument.layers[index].move(relativeObject, insertionLocation)
Description
Section titled “Description”Moves the object.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
relativeObject | Object | Object to move element within |
insertionLocation | ElementPlacement, optional | Location to move element to |
Returns
Section titled “Returns”Layer.remove()
Section titled “Layer.remove()”app.activeDocument.layers[index].remove()
Description
Section titled “Description”Deletes this object.
Returns
Section titled “Returns”Nothing.
Layer.zOrder()
Section titled “Layer.zOrder()”app.activeDocument.layers[index].zOrder(ZOrderCmd)
Description
Section titled “Description”Arranges the layer’s position in the stacking order of the containing layer or document (parent
) of this object.
Parameters
Section titled “Parameters”Parameter | Type | Description |
---|---|---|
zOrderCmd | ZOrderMethod | Stacking order arrangement method |
Returns
Section titled “Returns”Nothing.
Example
Section titled “Example”Bringing a layer to the front
Section titled “Bringing a layer to the front”// Moves the bottom layer to become the topmost layer
if (documents.length > 0) { var countOfLayers = activeDocument.layers.length; if (countOfLayers > 1) { var bottomLayer = activeDocument.layers[countOfLayers - 1]; bottomLayer.zOrder(ZOrderMethod.BRINGTOFRONT); } else { alert("The active document only has only 1 layer"); }}