Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression for checkboxes to change text

  • Expression for checkboxes to change text

    Posted by Thomas Crimmins on October 14, 2017 at 9:36 am

    Hi guys,

    Long time lurker, first time poster. I’m pretty inexperienced with expressions too. I’d like to know if someone can help me with achieving the following using expressions.

    I would like to be able to control the source text of a text layer by clicking 1 of 7 different checkboxes. So for simplicity’s sake (for me mainly) I mean if the first checkbox is checked of which corresponds to the word ‘dog’ then the source text will display ‘dog’. If I check on the second checkbox which corresponds to the word ‘cat’ then the source text will display ‘cat’ etc etc.

    Also it would be good if by checking each checkbox not only would it change the source text but also it’s position in the composition too.

    I’m not sure how difficult all this is and I hope it makes sense. Any help will be much appreciated.

    Many thanks.

    Thomas Crimmins replied 8 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 14, 2017 at 5:07 pm

    You could play around with this for source text:


    words = ["","one","two","three","four","five"];
    cb1 = effect("Checkbox Control")("Checkbox").value;
    cb2 = effect("Checkbox Control 2")("Checkbox").value;
    cb3= effect("Checkbox Control 3")("Checkbox").value;
    cb4 = effect("Checkbox Control 4")("Checkbox").value;
    cb5= effect("Checkbox Control 5")("Checkbox").value;
    idx = 0;
    if (cb1) idx = 1
    else if (cb2) idx = 2
    else if (cb3) idx = 3
    else if (cb4) idx = 4
    else if (cb5) idx = 5;
    words[idx]

    and this for position:


    cb2 = effect("Checkbox Control 2")("Checkbox").value;
    cb3= effect("Checkbox Control 3")("Checkbox").value;
    cb4 = effect("Checkbox Control 4")("Checkbox").value;
    cb5= effect("Checkbox Control 5")("Checkbox").value;
    y = 0;
    if (cb2) y = 100
    else if (cb3) y = 200
    else if (cb4) y = 300
    else if (cb5) y = 400;
    value + [0,y]

    Dan

  • Thomas Crimmins

    October 14, 2017 at 9:21 pm

    Thanks so much, Dan. Exactly what I was after!

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