ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How to correctly write a path to a layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nikolay Arkhipov
How to correctly write a path to a layer
on Dec 6, 2019 at 2:30:11 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!


Return to posts index

Alex Printz
Re: How to correctly write a path to a layer
on Dec 6, 2019 at 3:13:04 pm

try this

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

Alex Printz
Mograph Designer


Return to posts index

Nikolay Arkhipov
Re: How to correctly write a path to a layer
on Dec 6, 2019 at 3:23:51 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...


Return to posts index


Alex Printz
Re: How to correctly write a path to a layer
on Dec 6, 2019 at 3:46:54 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


Return to posts index

Nikolay Arkhipov
Re: How to correctly write a path to a layer
on Dec 6, 2019 at 3:52:22 pm

Thanks a lot! I'll try your method.


Return to posts index

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