Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Counting Layers in a comp

  • Counting Layers in a comp

    Posted by Obed Ampong on August 24, 2019 at 8:52 pm

    Hi,
    Please, I came across this expression to count layers in pre-comp somewhere. When I tried it, it seems to be working however it displays nothing. Could anyone help me out? Thanks in advance.
    Regards,

    Obed

    var myComp = app.project.activeItem;

    var myLayer = thisComp.layer("Comp 1")Layers[0];

    alert (myLayer.source.numLayers)

    Obed Ampong replied 6 years, 9 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    August 24, 2019 at 9:22 pm

    That looks like a script, not an expression. What do you want to do with the number?

    Dan

  • Dan Ebberts

    August 25, 2019 at 12:00 am

    If you apply this expression to the Source Text property of a text layer, it will display the number of layers in Comp 1:

    comp(“Comp 1”).numLayers

    Dan

  • Obed Ampong

    August 25, 2019 at 3:35 am

    Hello Dan,

    It works!!! Thank you very much.

    Regards,

    Obed

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy