Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Accessing text at specific keyframe

  • Accessing text at specific keyframe

    Posted by Jeremy Dance on September 5, 2018 at 9:20 pm

    I’m trying to test the first two characters in a string from text I got from keyframed text on a different text layer. I’ve successfully returned the string at the specific keyframe, but I can’t access the first two characters.

    watchLayerText = comp(“Typing”).layer(“firstPersonRefText”).text.sourceText.key(index);
    //if(watchLayerText.toString().substr(0,2) == “##”)true else false;
    //watchLayerText.charAt(0);

    This expression is in source text of another layer. When I just return watchLayerText it returns what I expect. However, using typeof I know what I’m grabbing is an object and not a string. When I cast it to a string all I get is “[Object Key]” and subsequent substrings of “[Object Key]”

    Both commented out lines don’t work because I’m working off an object not a string. How do I access the first two characters of the string in the object key?

    Dan Ebberts replied 7 years, 8 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    September 5, 2018 at 9:31 pm

    Try:

    .text.sourceText.key(index).value;

    Dan

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