-
Expression error: Could be out of range array subscript
Hi, I’m trying to write a very simple script that centers Y position for a text element wich is followed with more text elements below.
The full script is the following:
text01= thisComp.layer("Texto01").sourceRectAtTime(time, false);
text01height = text01.height;
text01verticalpos = thisComp.layer("Texto01").transform.xPosition;
text02= thisComp.layer("Texto02").sourceRectAtTime(time, false);
text02height = text02.height;
text02verticalpos = thisComp.layer("Texto02").transform.xPosition;
text03= thisComp.layer("Texto03").sourceRectAtTime(time, false);
text03height = text03.height;
text03verticalpos = thisComp.layer("Texto01").transform.xPosition;
text04= thisComp.layer("Texto04").sourceRectAtTime(time, false);
text04height = text04.height;
text04verticalpos = thisComp.layer("Texto01").transform.xPosition;
newBoxHeight = (text01verticalpos-tituloverticalpos) + (text02verticalpos-text01verticalpos) + (text03verticalpos-text02verticalpos) + (text04verticalpos-text03verticalpos) + text04height + (titulo.height/2);
newPos = (3040/2) - (newBoxHeight/2);
It works until the last line. After that, AE throws an error: “<b itemprop=”name” style=”font-family: inherit; font-size: inherit;”>Undefined value used in the expression (Could be out of range array subscript)“
<b itemprop=”name” style=”font-family: inherit; font-size: inherit;”>
<b itemprop=”name” style=”font-family: inherit; font-size: inherit;”>What did I do wrong? I tried closing the script with “newPos;”, “[newPos]” and “[newPos, newPos]” but nothing makes it work.
<b itemprop=”name” style=”font-family: inherit; font-size: inherit;”>
<b itemprop=”name” style=”font-family: inherit; font-size: inherit;”>Using AE 18.0 on MACos 10.14.6