FORUMS: list search recent posts

Three checkboxes

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Zura Bezhanishvili
Three checkboxes
on Mar 8, 2015 at 3:03:07 am
Last Edited By Zura Bezhanishvili on Mar 8, 2015 at 3:31:33 pm

I'm newbie here and i need some help

i have a three checkboxes and i need expression which can automatically disable two of them, when one of them is turned on.

Detailed: if i turn on the first checkbox then the other two should be automatically disabled and etc...

Is it possible?


Return to posts index

Dan Ebberts
Re: Three checkboxes
on Mar 8, 2015 at 7:20:16 am

I don't believe it can be done in a reliable way. Each of the three expressions feeds into the other two and I don't think you can set it up so that it will work correctly in all situations.


Return to posts index

Kevin Camp
Re: Three checkboxes
on Mar 9, 2015 at 8:12:45 pm

i've had some success by adding an addition slider control and using that to hold a value that would be used to help control the checkboxes...

try adding a slider to the same layer as your checkboxes, and manually set the value to 4 (or a value higher than the number of checkbox controls -- for some reason this seems to make it work). then add an expression like this to the slider value (set checkbox names as needed for your setup):

if ( effect("Checkbox Control")("Checkbox") == true ) 0;
else if ( effect("Checkbox Control 2")("Checkbox") == true ) 1;
else if ( effect("Checkbox Control 3")("Checkbox") == true ) 2;
else 0;

then use an expression like this on the first checkbox:

if ( effect("Slider Control")("Slider") == 0 ) true else false;

and the second:

if ( effect("Slider Control")("Slider") == 1 ) true else false;

and the third:

if ( effect("Slider Control")("Slider") == 3 ) true else false;

i put the slider at the bottom of the effects stack, but i'm not sure that matters.

Kevin Camp
Art Director

Return to posts index

Chris Scalzo
Re: Three checkboxes
on Mar 16, 2015 at 7:17:35 pm
Last Edited By Chris Scalzo on Mar 16, 2015 at 7:28:32 pm

Depending on what you are switching, you can create a precomp with solids labeled for choices and read the results of a layer control. Then you'd only get one of your three choices.

As an example, I made a precomp named "Pre-comp 1" and three layers named "OPT-1","OPT-2" and "OPT-3".

With the following expression I can return the value 1, 2 or 3 to change whatever else.

if (comp("Pre-comp 1").layer("OPT-1").effect("Layer Control")("Layer") == comp("Pre-comp 1").layer("OPT-1")){1};
if (comp("Pre-comp 1").layer("OPT-1").effect("Layer Control")("Layer") == comp("Pre-comp 1").layer("OPT-2")){2};
if (comp("Pre-comp 1").layer("OPT-1").effect("Layer Control")("Layer") == comp("Pre-comp 1").layer("OPT-3")){3};

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved