Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Controlling Source Text with checkbox controller

  • Kevin Camp

    September 6, 2017 at 10:26 pm

    yes, you just need to specify which comp and layer that the checkbox is in:

    check = comp("Comp 1").layer("Null 1").effect("Checkbox Control")("Checkbox");
    if ( check == true ) "some text" else "other text";

    change “Comp 1” and “Null 1” to be the comp name and layer name that has the checkbox control.

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Christian Simpson

    September 6, 2017 at 10:36 pm

    Thanks Kevin. I should have mentioned this earlier but what if you have several checkboxes? Would you just copy and paste the code or does something need to separate it?

  • Christian Simpson

    September 6, 2017 at 11:42 pm

    For example if I had one text layer and also had 3 checkbox controllers named Alpha Beta and Charlie and depending on which checkbox I checked the text would change. Not sure if the question makes sense.

  • Dan Ebberts

    September 7, 2017 at 3:48 pm

    You could do it like you did with the colors:


    L = thisComp.layer("Null 1");
    if(L.effect("Alpha")("Checkbox").value)
    "Alpha text"
    else if (L.effect("Beta")("Checkbox").value)
    "Beta text"
    else if (L.effect("Charlie")("Checkbox").value)
    "Charlie text"
    else
    "";

    Dan

  • Christian Simpson

    September 14, 2017 at 11:10 pm

    Hey Dan I thought I had this working but I guess I messed something up. I pasted my example below. The layer that has all my checkbox controls is in another comp. I’m wondering what I did wrong here?
    The error message I’m getting is this:
    Error at Line 1 in property ‘Color’ of layer 3 (‘Bottom Strip’) in comp ‘Home Team’. Unterminated string constant., an expression was disabled as a result of an error.
    Bottom strip is the shape I’m trying to apply the custom colors to.

    if(comp("!Team-Match-Up").layer("Home Team Control").effect("Alabama")("Checkbox”).value)
    [255, 255, 255, 0]
    else if (comp("!Team-Match-Up").layer("Home Team Control").effect("Arizona")("Checkbox”).value)
    [68, 25, 212, 0]
    else if (comp("!Team-Match-Up").layer("Home Team Control").effect("Arizona St")("Checkbox”).value)
    [158, 124, 12, 0]
    else
    value;

  • Dan Ebberts

    September 15, 2017 at 12:04 am

    It looks like some curly quotes slipped into your expression. You have 3 occurrences of:

    (“Checkbox”)

    which should be:

    (“Checkbox”)

    Dan

  • Christian Simpson

    September 15, 2017 at 3:37 am

    Good grief, you’re exactly right. Thanks Dan, you’re a lifesaver!

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