Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Checkbox Control failing

  • Checkbox Control failing

    Posted by Steve Bentley on February 1, 2008 at 11:39 pm

    Always on a Friday night!!!

    I have a check box control on a layer in an outer comp and I am testing it from an inner comp.
    I was working, now it’s not. So I simplified things, removed all the code, and used the pick whip, from the inner comp to the outer comp to get the value of that checkbox. (so I can be sure there are no typos)
    With an empty project, except for two comps with a solid in each, every thing works fine.
    But with my heavy project, the exact same scenario always produces a value of 1, no matter if the check box is toggled off or on. This is the ONLY checkbox in the entire project and it’s on a uniquely name layer.

    I have tried moving back and forth a frame or two, to “run in” to the frame and force a calculation, but nothing budges that returned value of 1.

    Thoughts?

    Cheers

    SB

    Rob Nairn replied 17 years, 11 months ago 4 Members · 9 Replies
  • 9 Replies
  • Steve Bentley

    February 1, 2008 at 11:53 pm

    It seems it’s not just a checkbox issue.
    If I make a new solid on the inner comp and link its opacity, say, to a layer in the outer comp, when I close out the pick whipped expression, AE tells me there is no such layer named for the one I just picked and disables the new expression.
    I could begrudgingly accept this if all the other expressions that are currently running in the inner comp using data accessed from the outer weren’t working, and the entire cross comp expression routine was failing, but the Checkbox test and this new routine are the only ones that fail – all others, and there are a lot of them, are working fine.
    Have I hit a high water mark?

    Cheers,
    SB

  • Filip Vandueren

    February 2, 2008 at 4:23 pm

    hi Steve,

    I’m not behind an AE station right now, but could you check if adding .value after the pickwhip for that checkbox returns a better result.
    Sometimes you need to add that because otherwise the expression could be interpreted as “does the checkbox object exist?” instead of “is it checked?”

    I’m not very sure I understand what’s happening in your second post, I’ll do some tests when I get home.

  • Filip Vandueren

    February 2, 2008 at 5:14 pm

    I’ve tested and can confirm:

    say you add this to the sourceText of a textlayer:

    comp("Comp 2").layer("Null 1").effect("Checkbox Control")("Checkbox")

    you get 1 or 0 depending on the checked state because javascript is correctly ‘casting’ the checkbox-object into a string containing it’s value. (the sourcetext expects a string)

    BUT !


    if (comp("Comp 2").layer("Null 1").effect("Checkbox Control")("Checkbox")) {
    1
    } else {
    0
    }

    always returns 1.
    The checkbox-object is cast to a logical value (“if” expects a true or false).
    In this case: true: the checkbox object exists.

    These WILL all work as expected however:

    if (comp(“Comp 2”).layer(“Null 1”).effect(“Checkbox Control”)(“Checkbox”).value)

    if (comp(“Comp 2”).layer(“Null 1”).effect(“Checkbox Control”)(“Checkbox”)==1)

    if (comp(“Comp 2”).layer(“Null 1”).effect(“Checkbox Control”)(“Checkbox”)==true)

    the last one is puzzling though: we don’t explicitly ask for the “value” of the object, so javascript again casts it to a logical value true/false, and it does work in this case…

    So I do consider this a bug.

  • Steve Bentley

    February 2, 2008 at 6:13 pm

    I had tried those as well – as a matter of course I’m usually a “==true” kind of guy anyway, and never testing for the string of 1.
    However this morning I have gone back to an older version of our project and it does seem to work there(== true). So either all the extra code I have added since(and there is a lot) has taken AE over a high water mark or the comp is simply corrupt – just the comp not the project.

    Attempting it with the same inner comp and a new outer comp works just fine. I have tried replacing the layer in the bad outer comp with a new one and a new checkbox, still no joy. It’s interesting that my corruption is also returning a “1”, as well.

    Thanks for the response.

    Cheers,
    Steve B

  • Filip Vandueren

    February 2, 2008 at 7:15 pm

    what does the .value method return when you put it on a Text-layer to debug ?

    try .toString() too, that should return: [object Property]

  • Lloyd Alvarez

    February 7, 2008 at 4:06 pm

    >>So I do consider this a bug.

    Hey Filip (and everyone else),

    I hope you file bugs with Adobe when you find them. This is the only way to make sure they are aware of them and queue them to be fixed. You can file bugs (and feature requests) here:

    <https://www.adobe.com/go/wish>

    -Lloyd

  • Rob Nairn

    June 10, 2008 at 2:54 am

    Hi all,
    The info here in this thread has almost got me over the line for a project I’m working on. I want to create different versions of comp using a check box that turn on or off different layers. The only problem is those layers already have opacity keyframes:
    So when their turned off this expression works a treat, when their turned on I want (for instance) the else part of the statement to return the values that are already keyframed.

    This is what I got so far:
    if (comp(“KT81109_cave monsterW2 OL”).layer(“Null 1”).effect(“NZ toggle -NZ if on”)(“Checkbox”)==true) {
    o
    } else {
    100
    }
    I want to replace the ‘100’ with something that will allow a fade to occur.

    Thanks in advance for any help you might be able to give.

    Cheers!

  • Lloyd Alvarez

    June 10, 2008 at 3:25 am

    Just replace the 100 with value like this:

    if (comp(“KT81109_cave monsterW2 OL”).layer(“Null 1”).effect(“NZ toggle -NZ if on”)(“Checkbox”)==true) {
    0
    } else {
    value
    }

    -Lloyd

    https://aescripts.com

  • Rob Nairn

    June 10, 2008 at 4:12 am

    Thats sensational! Thanks for the help.

    Cheers.

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