-
Split String Errors when using [1]
Here is my text:
Interviewing Verbal Communication
Interviewing Verbal Communication – Action Plan
Inexperienced % Describe a Conflict & Its Resolution
Inexperienced % Describe a Conflict & Its Resolution – Action Plan
Inexperienced % Describe a Conflict & Its Resolution # Español
Inexperienced % Describe a Conflict & Its Resolution # Español – Action PlanI am displaying one line at a time like this:
TextArray = text.sourceText.split('\r');
ArrayIndex = timeToFrames()%TextArray.length;TextArray[ArrayIndex];
That works great. Now, I have a second text layer called “SubText” that pulls just the first portion of this text. Here is my code:
ExperiencedOrInexperienced = thisComp.layer("LessonTextSource").text.sourceText.split(" % ")[0]if (ExperiencedOrInexperienced == "Experienced")
"Experienced"
else if (ExperiencedOrInexperienced == "Inexperienced")
"Inexperienced"
else
"ASDF";
This works fine. However, when I try to use the rest of the text by changing the [0] into a [1], I get an error:
After Effects warning: Expression disabled. Error at line 1 in property 'Source Text'
of layer 1 ("CornerText') in comp 'TestComposition'.
property or method named '1' in Class 'Array' is missing or does not exist. It may
have been renamed, moved, deleted, or the name may have been mistyped.
I assume that this errors because their instance of text where there is no %, but why would it only error when I am trying to pull the second half of the text?