-
Expression error – can’t find out what’s wrong with my syntax
Expressions question:
I’ve opened an old project in AE 16.1.1, and I get some expressions errors (as expected). I’ve fixed most of them, but five remain, and I don’t understand how I can fix them.
Here’s one of the expressions, and the error message. The syntax is very similar on the other four.
This code triggers an error on line 6: index 3 out of range for stream of dimension 1
txt = thisComp.layer("Source").text.sourceText;
i = Math.floor((txt.length-1)/2);
j = (txt.length%2) ? i : i+1;
n = -1;
while (i >= 0 && j < txt.length){
if (txt[i] == " "){
n = i;
break;
}else if (txt[j] == " "){
n = j;
break;
}
i--;
j++;
}
if (n < 0) txt; else txt.substr(0,n)Jarle Leirpoll
PremierePro.net