Skip navigation
Currently Being Moderated

Help with invalid expression

Jun 26, 2011 11:09 AM

In the book by Marcus Geduld "AfterEffectsExpressions" there is an example (p.145) that reads:


effect("4-Color Gradient").param(propertyIndex - 2).valueAtTime(time - .5)


This is an expression applied to one of the points in a 4-Color Gradient effect. It returns an error message:


Bad method arguments: propertyIndex can't be used in this Property. It seems odd that this book has a whole section that uses this expression that is apparently not valid.


BTW I have found a number of typos in the book which otherwise I enjoy and have learned plenty from. I would contact him if there was some link in his book but I find none.If someone can figure this one out I would really appreciate it.

  • Currently Being Moderated
    Jun 26, 2011 12:00 PM   in reply to sunithaya

    I think the problem is that when the book was written, thisProperty was implied when referring to attributes of the property housing the expression. Somewhere along the line it was changed so that now you have to explicitly include it. This should work:


    effect("4-Color Gradient").param(thisProperty.propertyIndex - 2).valueAtTime(time - .5)



    Mark as:
  • Currently Being Moderated
    Jun 26, 2011 3:01 PM   in reply to sunithaya

    Off the top of my head, the only other thing I can think of that has changed that would cause old expressions to break in newer versions of AE is that at some point  (I forget which version) the hack to read a text file using #include stop working and now requires $.eval() instead.


    As far as I know, Marcus's book is the only one dedicated to expressions. I don't know if he's planning an update.



    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points