ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
David Cabestany
Is not an object error, but it doesn't say what isn't
on Sep 20, 2017 at 4:10:42 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];


Return to posts index

Dan Ebberts
Re: Is not an object error, but it doesn't say what isn't
on Sep 20, 2017 at 5:21:44 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



Return to posts index

David Cabestany
Re: Is not an object error, but it doesn't say what isn't
on Sep 20, 2017 at 9:46: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.


Return to posts index


Dan Ebberts
Re: Is not an object error, but it doesn't say what isn't
on Sep 20, 2017 at 10:05:03 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



Return to posts index

David Cabestany
Re: Is not an object error, but it doesn't say what isn't
on Sep 20, 2017 at 10:13:46 pm

Thanks!!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]