Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Adding buttons to a UI panel from that UI panel stopped working in AE19 – works in 18

  • Adding buttons to a UI panel from that UI panel stopped working in AE19 – works in 18

    Posted by Jeroen Rommelaars on October 23, 2019 at 10:42 am

    Hey guys,
    I have a little UI panel with several buttons.
    One of these buttons should check some layers, and possibly add a new button to the UI.
    This always worked perfect in AE18 and before, but stopped working in AE19.

    I used this to add the button:
    var button = myPanel.grp.groupTwo.add("button", [1, 1, 80, 20], layerName);

    The actual group the button should be added to is created here, and works for the buttons actually added in the extendscript itself:
    res = "group{orientation:'row', spacing:0, margins:[0,0,0,0],\
    groupOne: Group {orientation:'column', alignment:['left','top']}groupTwo: Group {orientation:'column', alignment:['right','top']},\
    }";

    //UI elements

    myPanel.grp = myPanel.add(res);
    //dd = myPanel.grp.groupOne.add("dropdownlist", undefined, myList);
    //var applyButton = myPanel.grp.groupOne.add("button",[10,10,180,30],"apply ddl");
    var newScaleButton = myPanel.grp.groupOne.add("button", [1, 1, 80, 20], "new scale");
    //var subsButton = myPanel.grp.groupTwo.add("button", [1, 1, 80, 20], "subs");
    var vertButton = myPanel.grp.groupTwo.add("button", [1, 1, 80, 20], "vert pos");
    var firstName = myPanel.grp.groupOne.add("button", [1, 1, 80, 20], "first name");
    var lastName = myPanel.grp.groupTwo.add("button", [1, 1, 80, 20], "last name");

    The debugger highlights the row where the button is added and says “undefined is not an object”.
    Something has changed in AE19 Extendscript, but I have no idea what, nor do I know what method I should use to add buttons in ae19 since the debugger is no help at all.

    Does anyone know what could have changed?

    ps. the code still works perfectly in AE18.

    Jeroen Rommelaars replied 6 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 23, 2019 at 12:42 pm

    Hard to say without seeing it in context, but when it halts on error, I think I’d try a few $.writeln() commands in the console to see what the undefined object is. My guess is it’s myPanel. Then you figure out why it’s undefined at that point in the code…

    Dan

  • Jeroen Rommelaars

    November 8, 2019 at 1:59 pm

    Its been a while – but I figured out the solution. If someone ever encounters this as well:
    It had nothing to do with AE18/AE19.
    I was running two ui elements coded by me, and both of them were using a variable called myPanel for the ui buttons.
    I was under the impression that a variable like that would be contained in the script of one ui panel, but apparently it messed up when two panels were using the same name. It started adding buttons to the other panel, or bugged out completely.

    Hope this helps someone in the future 😉

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