92
JavaScript Reference
LayerCollection object
92
LayerCollection object
a p p . p r o j e c t . i t e m (
i nd e x
) . l a y e r s
Description
The LayerCollection object represents a set of layers. The LayerCollection belonging to a CompItem object
contains all the layer objects for layers in the composition. The methods of the collection object allow you to
manipulate the layer list.
•
LayerCollection is a subclass of Collection. All methods and attributes of Collection, in addition to those
listed below, are available when working with LayerCollection. See “Collection object” on page 51.
Example
Given that the first item in the project is a CompItem and the second item is an AVItem, this example shows
the number of layers in the CompItem's layer collection, adds a new layer based on an AVItem in the project,
then displays the new number of layers.
v a r f ir s t C o m p = a p p . p r o j e ct . i t e m ( 1 ) ;
v a r l a y e r C o l l e c t i o n = f i r s t C o m p . l a y e r s ;
a l e r t ( " n u m b e r o f l a y e r s b e f o r e i s " + l a y e r C o l l e c t i o n . l e n g t h ) ;
v a r a n A V I t e m = a p p . p r o j e c t . i t e m ( 2 ) ;
l a ye r C o l l e c t i o n . a d d ( a n A V I t e m ) ;
a l e r t ( " n u m b e r o f l a y e r s a f t e r i s " + la y e r C o l l e c t i o n . l e n g t h ) ;
Methods
Method
Reference
Description
a d d ( )
“LayerCollection add() method” on
page 93
Creates a new AVLayer and adds it to this collection.
a d d N u l l ( )
“LayerCollection addNull() method” on
page 94
Creates a new, null layer and adds it to this collection.
a d d S o l i d ( )
“LayerCollection addSolid() method” on
page 94
Creates a new layer, a FootageItem with a SolidSource, and adds it
to this collection.
a d d T e x t ( )
“LayerCollection addText() method” on
page 95
Creates a new text layer and adds it to this collection.
a d d C a m e r a ( )
“LayerCollection addCamera() method”
on page 93
Creates a new camera layer and adds it to this collection.
a d d L i g h t ( )
“LayerCollection addLight() method” on
page 93
Creates a new light layer and adds it to this collection.
a d d S h a p e ( )
“LayerCollection addShape() method”
on page 94
Creates a new shape layer and adds it to this collection.
b y N a m e ( )
“LayerCollection byName() method” on
page 95
Retrieves the layer object with a specified name.
p r e c o m p o s e ( )
“LayerCollection precompose()
method” on page 96
Collects specified layers into a new composition.
Summary of Contents for 65009963 - After Effects CS4
Page 1: ...SCRIPTING GUIDE...