5 Replies Latest reply on Jun 22, 2015 7:04 AM by nicoDuduf

    Can't close windows and palettes created in a script (CC)

    nicoDuduf Level 1

      Hi,

       

      I developped a Script for After Effects, and sometimes I need to show a window or a palette, but when this window is showed more than once, it can't be closed again (the close button, the one with the cross on the title bar) does nothing, whether it's a palette or a window.

       

      Here's my sample code :

       

      creating the palette :

       

      var mesurefenetre = new Window ("palette", "test",undefined, {resizeable:true});

      var resultattexte = mesurefenetre.add("statictext",undefined,"text added");

       

      showing the palette is done with a button in my main panel :

       

      var bouton = fenetre.add("button",undefined,"mesure");

      bouton.onClick = function () { mesurefenetre.show(); };

       

      But with this code, when the window is shown once, then closed, then shown again, it then can't be closed...

      So I tried to reimplement onClose on the window :

       

      mesurefenetre.onClose = function () { mesurefenetre.close(); }; //does nothing

      mesurefenetre.onClose = function () { mesurefenetre.hide(); }; //does nothing

       

      So my current workaround is to use the button in my main panel to check if the window is visible and hide it...

       

           bouton.onClick = function () { if (mesurefenetre .visible) mesurefenetre .hide(); else mesurefenetre .show(); }; //don't like this behavior, really not user friendly

       

      This example is with a palette, but it does not work with a window too.

       

      This seems to be a bug from After Effects, it worked well with CS4~CS6, (used this in Duik (http://ik.duduf.com) for a long time)

      Any idea what I can do ?

       

      Thanks,

      Duduf