Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Expression error: Could be out of range array subscript

  • Expression error: Could be out of range array subscript

  • Pau Amer

    June 10, 2021 at 1:47 pm

    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

  • Andrei Popa

    June 10, 2021 at 3:46 pm

    I assume this expression is written in the x position after you separated dimensions?

    You have tituloverticalpos and titulo.height in the newBoxHeight calculations that does not seem to be declared anywhere.

Viewing 1 - 2 of 2 posts

Log in to reply.

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