Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Cant return two values in a other layer

  • Cant return two values in a other layer

    Posted by Pascal Frei on November 3, 2020 at 7:57 am

    Hello there, i got trouble with my code, i have two diffrent comps with two text-layers. I will show those texts from this layers in a thirt layer.

    I got Headline1, Headline2 and the resultheadline. This code is add to the resultheadline:

    var a = thisComp.layer(“Headline2”).text.sourceText.getStyleAt(0,0);

    a = a.setText(footage(“myFile.json”).sourceData.productname);

    var b = thisComp.layer(“Headline1”).text.sourceText.getStyleAt(0,0);

    b = b.setText(footage(“myFile.json”).sourceData.headlineproduct);

    function myFunction(a, b){

    result = a + b ;

    return result;

    }

    value = myFunction(a, b);

    I get no error message, AF is just show me [object Object][object Object]]

    How can i return the values from Headline1+2 in resultheadline?

    Thanks a lot for your help!

    Kind regards PF

    Brendon Murphy replied 5 years, 9 months ago 2 Members · 3 Replies
  • 3 Replies
  • Brendon Murphy

    November 3, 2020 at 9:40 pm

    Try this in the resultheadline source text:

    var a = thisComp.layer("Headline1").text.sourceText;

    var b = thisComp.layer("Headline2").text.sourceText;

    a+", "+b;

  • Pascal Frei

    November 4, 2020 at 12:44 pm

    Hello Brandon,

    Thanks a lot for your reply. Yes sure in this case it works. But when you have a closer look at the code i have written you can see I need also the stylized information propperties. And thats the reason i think why i get this error [object Object][object Object]] AF cant handle this..

    mabey now you know what I mean.. Thanks for your support

  • Brendon Murphy

    November 4, 2020 at 9:29 pm

    Gotcha. I’m not sure if you can combine two separate text styles on one layer using expressions. Let’s see if anyone else has seen this.

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