Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Counting Expresson not working.

  • Counting Expresson not working.

    Posted by John Cuevas on February 15, 2012 at 7:58 pm

    I add this expression to my Source text and I keep recieving an “invalid numeric result(divide by zero?) error.

    If I change the “myNum = time” no error, it displays time + percent. Also if I just link to the slider, no error, my number is displayed.

    It’s not that I can’t just put a percent sign behind the counter, I want to know why this isn’t working

    Thanks,

    myNum = effect("Slider Control")("Slider");
    myNum + "%"

    Johnny Cuevas, Editor
    Thinkck.com

    “I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work.”
    —THOMAS EDISON on inventing the light bulb.

    John Cuevas replied 14 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 15, 2012 at 8:33 pm

    Sometimes the expression engine doesn’t automatically convert expression control objects to values and you have to explicitly tell it to do so, like this:

    myNum = effect(“Slider Control”)(“Slider”).value;
    myNum + “%”

    This is another way to fix it:

    myNum = effect(“Slider Control”)(“Slider”);
    “” + myNum + “%”

    Apparently forcing the string conversion (with the “”) also causes the value to be retrieved.

    Dan

  • John Cuevas

    February 15, 2012 at 8:36 pm

    Thank you Dan, that was driving me nuts. Good thing to remember for the future.

    Johnny Cuevas, Editor
    Thinkck.com

    “I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work.”
    —THOMAS EDISON on inventing the light bulb.

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