Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions if/else if statements

  • if/else if statements

    Posted by Sean Platt on September 5, 2023 at 2:28 pm

    Hello. I am trying to use if/else if statements to align bullet points and their respective line(s) horizontally based on how many bullet points are turned on with a checkbox.

    Each bullet point has a 1 line of copy option and a 2 lines of copy option.

    The position for bullet points 2 is driven by the position of bullet point 1. Bullet point 3 is driven by the position of bullet point 2. And so on.

    My idea was to say if, for example, checkboxes for bullet point 2, 1 copy line and bullet point 2, 2 copy lines are off, do not adjust bullet point 1 on the y-axis. But if one of those checkboxes is on, adjust bullet point 1 on the y-axis. Then to use else if statements to build on that (reposition bullet point 1 on the y-axis) if the checkbox for bullet point 3 is on and so on.

    However, my “attempt” is not working :). I have attached the code showing up to bullet point 4.

    I am guessing it is because I am combining different operators in one statement but not sure.

    Any suggestions? Thank you!

    Brie Clayton replied 10 months, 2 weeks ago 3 Members · 3 Replies
  • 3 Replies
  • Filip Vandueren

    September 7, 2023 at 11:00 am

    Hi Sean,

    that’s a lot of code to work through on a screenshot, so I haven’t

    At first glance it all looks OK, but the first thing I would try is to change all the assignments at the start of your code by ending them with …(“Checkbox”) .value;

    a Checkbox is an object, not a number, usually Javascript/expressions are smart and ‘cast’ the object to be its value according to the context, but maybe in this case that’s what’s breaking.

    Also, and perhaps that’s the more likely culprit:

    I would group all conditions of the if check into a set of parentheses, so don’t say:

    if (a ==1) || (b==1) {


    if ( (a==1) || (b==1) ) {

    In practice you could also dismiss all the ==1 because if they are 1, they are already True.

    if ( a || b)

  • Sean Platt

    September 7, 2023 at 1:28 pm

    Thank you so much, Filip! The omitted parentheses was indeed the culprit! Really appreciate it!

  • Brie Clayton

    September 7, 2023 at 1:45 pm

    Thank you for the solve, Filip!

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