Answers.Body: <p>The layers in a pre-comp don't have access to information about the comp(s) they're nested in AFAIK, but I can think of a workaround in this case: apply a fill effect to the nested layer and drive its colour value using the name of the parent comp, e.g. </p>
  
  <pre><code>if (thisComp.name == "Blue"){[0,0,255]}
  else if (thisComp.name == "Red"){[255,0,0]}…
  </code></pre>
  
  <p>and so on. Or you could name the comps by their colour values— something like <code>255-123-001</code>—and use js string methods to extract the colours from the comp name. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-21T04:53:08.587Z
Answers.LastActivityDate: 2015-08-21T04:53:08.587Z
Answers.UserDisplayName: stib
Body: <p>This question was <a href="https://video.stackexchange.com/questions/12413/any-way-to-change-properties-of-subcomp-based-on-parent-comp">asked almost a year ago</a>, and no solutions were offered at that time. The original poster described exactly what was needed in a follow-up comment which can't be linked to directly, so I'm pasting here for reference:</p>
  
  <blockquote>
    <p>Imagine a comp called 'Red," within which is nested a comp called 'Circle.' Red has a color picker set to red, and Circle takes its color from Red. Now I want to duplicate Red, call it Blue, and have Circle -- the same Circle precomp, not a copy of it -- become blue when it's nested within 'Blue.' Does that make sense? Apparently it's not possible. Blue would have to be duplicated in order to reference the new parent comp. There is no way for a comp to discover which comp it is nested in. –  Ze'ev Aug 20 '14 at 15:41</p>
  </blockquote>
  
  <p>I've found myself needing to do exactly the same thing. Was hoping with a year having passed new SE users might know a way to do this, or AE CC 2015 has added a slick way to do this. My research efforts including combing through SE, reading several Q&amp;As and articles on Adobe's site, Google searches of course, no dice across the board. Grateful for assistance.</p>
  
  <p>Thanks,
  - DK</p>
  
Tags: <after-effects>
Title: Change props of subcomp based on parent comp
UserDisplayName: Dave
ThreadText: # Change props of subcomp based on parent comp
  
  (Asked by: username_0 on 2015-08-19)
  
  This question was [asked almost a year ago](https://video.stackexchange.com/questions/12413/any-way-to-change-properties-of-subcomp-based-on-parent-comp), and no solutions were offered at that time. The original poster described exactly what was needed in a follow-up comment which can't be linked to directly, so I'm pasting here for reference:
  
  > Imagine a comp called 'Red," within which is nested a comp called 'Circle.' Red has a color picker set to red, and Circle takes its color from Red. Now I want to duplicate Red, call it Blue, and have Circle -- the same Circle precomp, not a copy of it -- become blue when it's nested within 'Blue.' Does that make sense? Apparently it's not possible. Blue would have to be duplicated in order to reference the new parent comp. There is no way for a comp to discover which comp it is nested in. – Ze'ev Aug 20 '14 at 15:41
  
  I've found myself needing to do exactly the same thing. Was hoping with a year having passed new SE users might know a way to do this, or AE CC 2015 has added a slick way to do this. My research efforts including combing through SE, reading several Q&As and articles on Adobe's site, Google searches of course, no dice across the board. Grateful for assistance.
  
  Thanks,
  - DK
  
  **Tags:** after-effects
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-08-21. Score: 1
  
  The layers in a pre-comp don't have access to information about the comp(s) they're nested in AFAIK, but I can think of a workaround in this case: apply a fill effect to the nested layer and drive its colour value using the name of the parent comp, e.g.
  
  ```
  if (thisComp.name == "Blue"){[0,0,255]}
  else if (thisComp.name == "Red"){[255,0,0]}…
  
  ```
  
  and so on. Or you could name the comps by their colour values— something like `255-123-001`—and use js string methods to extract the colours from the comp name.
  
  
  ---
  
  