Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Real Quick Expression Question

  • Real Quick Expression Question

    Posted by Tyler Paul on November 6, 2006 at 7:36 pm

    I’m having trouble with IF statements

    What I want is if a checkboxA is off then checkboxB is off but if CheckboxA is on then CheckboxB be can be on or off

    I have (not exactly but close enough)

    If(thiscomp.layer.effect(“Paint Layer”)=0)thiscomp.layer.effect(“Paint Layer”)

    Which should mean if CheckboxA is 0 then this checkbox is 0. I get a ‘can’t appear on the left hand side of an assignment, because it is read only” error

    what am I doing wrong

    Tyler Paul replied 19 years, 6 months ago 4 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    November 6, 2006 at 7:49 pm

    This should do it:

    if(effect(“Paint Layer”)(“Checkbox”) == 0) 0 else value

    Dan

  • Julian Sixx

    November 6, 2006 at 7:58 pm

    Hi
    why not just pickwhiping CheckboxA with the other Checkbox?

  • Dan Ebberts

    November 6, 2006 at 8:04 pm

    Because he only wants to force the values to be the same if the first checkbox is off.

    Dan

  • Tyler Paul

    November 6, 2006 at 9:25 pm

    Well, I found an obvious work around but I still wanted to try to get this to work and it’s still a no go.

    This is exactly what I have

    if(thisComp.layer(“input Output”).effect(“Paint Layer”)(“Checkbox”)= 0) 0 else value

    I have tried a bunch of variations. Generally always got the same error.

  • Tyler Paul

    November 6, 2006 at 9:31 pm

    Oh… got it. I thought the == was a typo and when I tried using the double equals I must of already had something else screwing it up.

    Can you tell me why it needs two equal signs?

  • Filip Vandueren

    November 6, 2006 at 11:32 pm

    in Javascript (and many other languages)

    = means ‘assign a value’ or ‘set to’ as in: var foo=”hello”;

    == means ‘is equal to’ as in: if (foo==”hello”)

    when you ask if(foo=”hello”), you’re setting foo, and the if checks the result value of that operation (usually it’s true, because the setting of the variable was succesful);
    so not only is this always true, after if(fo=”hello”), you’ve erased the previous value of foo.

    Makes sense ?

  • Tyler Paul

    November 7, 2006 at 12:16 am

    Yeah, that makes sense.

    My programming skills never went much further than Qbasic. (Although I know the hell out of it!)

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