ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Accessing text at specific keyframe

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jeremy Dance
Accessing text at specific keyframe
on Sep 5, 2018 at 9:20:41 pm
Last Edited By Jeremy Dance on Sep 5, 2018 at 9:21:46 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?


Return to posts index

Dan Ebberts
Re: Accessing text at specific keyframe
on Sep 5, 2018 at 9:31:10 pm

Try:

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


Dan



Return to posts index

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