FORUMS: list search recent posts

Accessing comp name using Extendscript

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
tolga burcak
Accessing comp name using Extendscript
on Mar 13, 2018 at 9:33:21 pm

Hi

I create two compositions with script. First one is myComp, second one is comp_0.

When I add comp_0 into myComp timeline, I can see it. But when I try to change something inside comp_0 with script, it returns undefined.

comp_0 acts like an AV Layer, not as a composition. I can change its property (scale) but I can't reach layers in it.

alert(myComp);
// shows [object CompItem]

alert(MyComp.layer.("comp_0"));
// shows [object AVLayer]


Return to posts index

Walter Soyka
Re: Accessing comp name using Extendscript
on Mar 14, 2018 at 2:03:46 pm

[tolga burcak] "When I add comp_0 into myComp timeline, I can see it. But when I try to change something inside comp_0 with script, it returns undefined. comp_0 acts like an AV Layer, not as a composition. I can change its property (scale) but I can't reach layers in it.

alert(MyComp.layer.("comp_0"));
// shows [object AVLayer]

"


When you use a comp's layer() method, it returns a layer by design; a comp is not a group that exposes its internal members to the containing comp. If you want access to the project item which is used by the layer, you need to use the AVLayer's source() method:

alert(MyComp.layer("comp_0").source);

This will return a CompItem. Of course, you create an object to refer to this CompItem:

ThatOtherComp = MyComp.layer("comp_0").source;

But if you're adding comp_0 to the composition programmatically in your script, you may already have an object you can use.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]