Adobe 65009963 Scripting Manual page 140

After effects cs4
Table of Contents

Advertisement

JavaScript Reference
PropertyBase object
a pp .p r o j e c t .i te m (i nd e x) .l ay e r ( inde x) .p r op e r t y S p ec
Description
Properties are accessed by name through layers, using various kinds of expression syntax, as controlled by
application preferences. For example, the following are all ways of access properties in the Effects group:
va r effect1 = a pp.pro ject .item (1 ).la yer( 1 ) . e f f e c t ( " A d d G r a i n " ) ( " V i e w in g M o d e " ) ;
v a r e f f e c t1 ag a in = ap p .p r o j e c t. it e m ( 1) .la yer( 1) .ef f ect. ad d Gr ain.v ie wingM od e;
v a r e f f e c t1 ag a in to o = ap p .p r o j e c t. it e m ( 1 ) .l a y e r ( 1 ) (" E f f e c ts " ) .a dd G r ai n . v i e w in g M o d e ;
v a r e f f e c t1 ag a in to o 2 = a pp .p r o je c t .i te m (1 ). l ay er ( 1 ) ( " E ff e c t s" ) ( " A d d G r a i n " )( " V i e w i n g M o de " );
See also "PropertyGroup property() method" on page 149.
PropertyBase is the base class for both Property and PropertyGroup, so PropertyBase attributes and
methods are available when working with properties and property groups. See "Property object" on
page 118 and "PropertyGroup object" on page 147.
Reference invalidation
When something occurs that changes an object sufficiently for the reference to become invalid, script refer-
ences to that object can generate errors. In simple cases this is straightforward. For example, if you delete an
object, a reference to the deleted object generates the warning "Object is Invalid":
v a r l ay e r 1 = ap p .p r o je c t.i t e m ( 1 ) .l ay e r (1 );
la ye r1. remov e();
a l ert (l a ye r1. n am e ); / / i n v al i d r ef eren ce to d ele ted obj ect
Similarly, if you reference an AE property in a deleted object, the warning occurs:
v a r l ay e r 1 = ap p .p r o je c t.i t e m ( 1 ) .l ay e r (1 );
v a r l a y e r 1 p o s i t i o n = l a y e r 1 . t r a n s f o r m . po s i t i o n ;
la ye r1. remov e();
a l e r t (l a ye r 1 p o s i ti o n . v al u e ); / / in v al i d r ef e r e n c e t o p r o p e r t y i n s e l e c t e d o b j e c t
A less straightforward case is when a property is removed from a property group. In this case, After Effects
generates the "Object is Invalid" error when you subsequently reference that item or other items in the group,
because their index positions have changed. For example:
v a r e f f e c t1 = a pp .p r o je c t .i te m (1 ).l a y e r ( 1 ) .ef f e c t (1) ;
v a r e f f e c t2 = a pp .p r o je c t .i te m (1 ).l a y e r ( 1 ) .ef f e c t (2) ;
va r effect2 pa ram = a pp.proj ect. item (1 ) .l a y e r ( 1 ) .ef f e c t( 2 ) .b l e n dW i t hO r i g i n al ;
e f f e c t1 .r e m o v e () ;
a l e r t (e ff e c t 2 .n a m e ) ; / / i n v a li d r e f e r e n c e b e ca u s e g r o u p in de x p o s i ti o n s h a v e c h an g e d
Attributes
Attribute
Reference
n a m e
"PropertyBase name attribute" on
page 144
m a t c h N a m e
"PropertyBase matchName attribute"
on page 143
Description
Name of the property.
A special name for the property used to build unique naming paths.
PropertyBase object
140
140

Advertisement

Table of Contents
loading

This manual is also suitable for:

Creative suite 3 after effects

Table of Contents