3 Replies Latest reply: Jun 26, 2011 3:01 PM by Dan Ebberts RSS

    Help with invalid expression

    sunithaya

      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.

        • 1. Re: Help with invalid expression
          Dan Ebberts Community Member

          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)

           

          Dan

          • 2. Re: Help with invalid expression
            sunithaya Community Member

            Dan, right on, thank you for the quick response. It works like a charm. I wonder how many more things like that have changed in the last 2-3 years (the book seems to be from 2008-9) Any reccomendations as to a more up-to-date book on the subject?

             

            thanks a mil

            • 3. Re: Help with invalid expression
              Dan Ebberts Community Member

              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.

               

              Dan