Skip to main content
YuK1_Works
Inspiring
August 4, 2024
Answered

[Expressions] How to refer to a comp one level above.

  • August 4, 2024
  • 3 replies
  • 689 views

Can I reference a composition one level up in Expression?
Main > Level 1 > Level 2.
Is there a way to access a "Level 1" composition from a "Level 2" layer in a flowchart like this?
I would like to specify a composition as "one above" instead of specifying it by name.

Correct answer YuK1_Works

Essential Properties (Essential Graphics) did what I wanted to do.
What I wanted to do by referencing the hierarchy above Comp was to switch what was displayed in Comp.
This was accomplished by adding arbitrary Expression controls to the Essential Properties and applying the appropriate Expression to the layer I wanted to switch the display to.
Since the Essential Properties can be set for each placed layer, this demand was met perfectly.

3 replies

YuK1_Works
YuK1_WorksAuthorCorrect answer
Inspiring
December 3, 2024

Essential Properties (Essential Graphics) did what I wanted to do.
What I wanted to do by referencing the hierarchy above Comp was to switch what was displayed in Comp.
This was accomplished by adding arbitrary Expression controls to the Essential Properties and applying the appropriate Expression to the layer I wanted to switch the display to.
Since the Essential Properties can be set for each placed layer, this demand was met perfectly.

YuK1_Works
Inspiring
December 3, 2024

An example of doing that:
Add a Dropdown menu control to the Null layer and add the option to toggle the display to the menu.
Add like the following expression to the Opacity of the layer you want to switch the visibility of.

let f = thisComp.layer("Null").effect("Dropdown menu control")(Menu);
// This number ties the choice to the layer.
// Change it appropriately.
let n = 1;
f == n ? 100 : 0;

 

Participating Frequently
December 3, 2024

I need this too. Would be nice. 

Dan Ebberts
Community Expert
Community Expert
December 3, 2024

The problem, of course, is that a comp can be nested inside any number of other comps. So what would be the expected result for "parentComp" when that could be anywhere from zero to "n" other comps?

Dan Ebberts
Community Expert
Community Expert
August 4, 2024

There's no mechanism to reference another comp, other than by name.