ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Access items within a composition using its layer number?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Spencer Evans
Access items within a composition using its layer number?
on Nov 13, 2018 at 10:25:26 pm
Last Edited By Spencer Evans on Nov 13, 2018 at 10:55:34 pm

Hello, I'm not great at coding and I'm trying to figure out how to link properties in my main comp (A) to items in other compositions (B). The names and layer index of those other compositions (B) will vary, but they will each contain a layer which these properties in main comp (A) link to. Also, these other compositions (B) will *always* be the last layer in my main comp (A).

Basically, my big question is: is it possible to access items within a composition using its layer number and *not* its name? If not, what other solutions might I consider?

Thanks all!

P.S. I have tried to change the layer name on all my sub comps (B) to be the same ("Frame" in this case) but this didn't seem to work. I guess you can only reference a comp by its source name and not layer name?

Update:
I have come up with a solution but it's not the cleanest. I just have to change the name of a null object (layer 1) in each comp so that it references the correct comp. Any advice on simplifying this is welcome.
n = thisComp.layer(1).name;
comp("Frame_"+n).layer("Text BG").content("Border").content("Rectangle Path 1").size


Return to posts index

Dan Ebberts
Re: Access items within a composition using its layer number?
on Nov 13, 2018 at 11:45:47 pm

>Also, these other compositions (B) will *always* be the last layer in my main comp (A).

If that's the case, you could get to the other comp this way:

otherComp = thisComp.layer(thisComp.numLayers).source;



Dan



Return to posts index

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