user18583: In this case, I am selecting a precomp in the timeline but the problem is that this code below returns the AVLayer object instead of a CompItem object. How can I select the layer but get it as aCompItem. I need to do this because I want to then access the layers inside the precomp.
var comp = app.project.activeItem.selectedLayers[0];
alert(comp);



user18583: Well, I found my own answer. I just needed to access the source property.
var comp = app.project.activeItem.selectedLayers[0].source;
alert(comp);



18583: <p>In this case, I am selecting a precomp in the timeline but the problem is that this code below returns the AVLayer object instead of a CompItem object. How can I select the layer but get it as aCompItem. I need to do this because I want to then access the layers inside the precomp.</p>
<pre><code>var comp = app.project.activeItem.selectedLayers[0];
alert(comp);
</code></pre>
<p><a href="https://i.stack.imgur.com/P9DRk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P9DRk.png" alt="enter image description here" /></a></p>
 18583: <p>Well, I found my own answer. I just needed to access the source property.</p>
<pre><code>var comp = app.project.activeItem.selectedLayers[0].source;
alert(comp);
</code></pre>
<p><a href="https://i.stack.imgur.com/bA3Yb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bA3Yb.png" alt="enter image description here" /></a></p>
