Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Accessing comp name using Extendscript

  • Accessing comp name using Extendscript

    Posted by Tolga Burcak on March 13, 2018 at 9:33 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]

    Walter Soyka replied 8 years, 5 months ago 2 Members · 1 Reply
  • 1 Reply
  • Walter Soyka

    March 14, 2018 at 2:03 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   |   RenderBreak [blog]   |   Profile [LinkedIn]

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy