Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is not an object error, but it doesn’t say what isn’t

  • Is not an object error, but it doesn’t say what isn’t

    Posted by David Cabestany on September 20, 2017 at 4:10 pm

    I’m getting the following error:

    But I can’t understand what is it that it’s not an object.

    Can anyone explain?
    Thanks.

    x=transform.position[0];
    y=transform.position[1];

    t=text.length;
    if
    (t>34)
    {
    z=-89.2
    }
    else
    z=-41.2
    [x,y,z];

    David Cabestany replied 8 years, 11 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    September 20, 2017 at 5:21 pm

    I think you’re getting that error because there’s no semi-colon on the next-to-last line. But you have another error in your source text length reference. I’d do it like this:

    x=transform.position[0];
    y=transform.position[1];
    t=text.sourceText.length;
    z = (t > 34) ? -89.2 : -41.2;
    [x,y,z]

    Dan

  • David Cabestany

    September 20, 2017 at 9:46 pm

    Thanks Dan, Yes I noticed the semicolon and after I added it it was indeed fixed.
    Semicolons are tricky, sometimes you need them and sometimes they will break the expression.

    However, after that it works fine, what error are you referring to?
    Also, what are “?” and “:” in the conditional? Are those replacements for the flat and curly brackets and the else statement?

    Thanks a lot for your help.

  • Dan Ebberts

    September 20, 2017 at 10:05 pm

    >what error are you referring to?

    t=text.sourceText.length; vs t=text.length;

    >Also, what are “?” and “:”

    That’s the JavaScript Conditional (Ternary) operator–a more compact version of if/else

    Dan

  • David Cabestany

    September 20, 2017 at 10:13 pm

    Thanks!!

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