Adobe 65009963 Scripting Manual page 92

After effects cs4
Table of Contents

Advertisement

JavaScript Reference
LayerCollection object
a pp .p r o j e c t .i te m (i nd e x) .l ay 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.
va r f ir st C omp = ap p. pr oje ct .i t em( 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 an A V I t e m = ap p .p r o je c t.i t e m ( 2 ) ;
l a ye r C o l l e c t i o n . a dd ( a n A VI 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 is " + la y e r C o l l e c t i o n . l e n g t h ) ;
Methods
Method
Reference
a dd ( )
"LayerCollection add() method" on
page 93
a dd N u l l ( )
"LayerCollection addNull() method" on
page 94
a dd S ol i d( )
"LayerCollection addSolid() method" on
page 94
a dd T ex t ()
"LayerCollection addText() method" on
page 95
a dd C a m era ()
"LayerCollection addCamera() method"
on page 93
a dd L i g ht ()
"LayerCollection addLight() method" on
page 93
a dd S ha pe ()
"LayerCollection addShape() method"
on page 94
b y N a m e ( )
"LayerCollection byName() method" on
page 95
"LayerCollection precompose()
p rec o m po se ()
method" on page 96
Description
Creates a new AVLayer and adds it to this collection.
Creates a new, null layer and adds it to this collection.
Creates a new layer, a FootageItem with a SolidSource, and adds it
to this collection.
Creates a new text layer and adds it to this collection.
Creates a new camera layer and adds it to this collection.
Creates a new light layer and adds it to this collection.
Creates a new shape layer and adds it to this collection.
Retrieves the layer object with a specified name.
Collects specified layers into a new composition.
LayerCollection object
92
92

Advertisement

Table of Contents
loading

This manual is also suitable for:

Creative suite 3 after effects

Table of Contents