Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to correctly write a path to a layer

  • How to correctly write a path to a layer

    Posted by Nikolay Arkhipov on December 6, 2019 at 2:30 pm

    Hi everyone!

    I’ve got a problem, and I’ll try to explain it below.

    For example, I’ve got a main composition, and it’s called “Style 1”. Inside this main comp I’ve got a text layer and an internal composition called “Shadow”, where there are several text and shape layers. So, I need to link the text from the “Shadow” comp with the text from the main “Style 1” comp. And everything works fine.. until I start duplicating these comps! I duplicate the main “Style 1” comp (in project files tab), and it becomes a Style 2 comp, then I place it into the timeline, duplicate the internal “Shadow” comp (both on the timeline and in the project files tab, it then becomes Shadow 2 comp), I relink the duplicated internal comp with the duplicated comp in the project files tab… But the expressions don’t change to comp(“Style 2”)… I even tried to duplicate and relink all the layers, but it doesn’t work either. Please, tell me what I am doing wrong… How to make the expressions change their names to the names of the duplicated comps?

    Thanks in advance!

    Nikolay Arkhipov replied 6 years, 6 months ago 2 Members · 4 Replies
  • 4 Replies
  • Alex Printz

    December 6, 2019 at 3:13 pm

    try this

    thisComp.layer("targetLayer") .....

    Alex Printz
    Mograph Designer

  • Nikolay Arkhipov

    December 6, 2019 at 3:23 pm

    Well, and how it is supposed to work? The very matter is that the text layers, I link, are in different comps… And, if I understood you correctly, the suggested expression is for the layers that are based in the same composition…

  • Alex Printz

    December 6, 2019 at 3:46 pm

    Ah I see, I misunderstood you, I thought you wanted your expressions to link inside your current comps no matter what.

    Try something like this to parse an integer from the end of the current comp’s name and add it to the end of the target comp’s “Style” name:

    n = thisComp.name;
    i = parseInt(n.split(” “)[1]);

    targetComp = comp(“Style “+i);

    Alex Printz
    Mograph Designer

  • Nikolay Arkhipov

    December 6, 2019 at 3:52 pm

    Thanks a lot! I’ll try your method.

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