17 Replies Latest reply on May 23, 2017 12:23 PM by pixxxel schubser

    .fill is not a function, Error 24


         Hello, I have a question for the community. I am attempting to write a script(in JavaSCript) that selects the underlined layers(see the image bellow) and applies a      color fill to them...

          I am not sure why but I get the following error: "Error 24: class2.fill is not a function.
                  Here is my code, written in JavaScript:

                     function setColor1(){

                           var Color = new SolidColor;

                           Color.rgb.hexValue = '7f7f7f';

                               var doc = app.activeDocument;

                               var colorGroup = doc.layerSets.getByName('COLORGROUP');
                                var class2 = colorGroup.layers.getByName('CLASS2");

                               alert(class2.kind) // patternfill
                                 class2.fill(Color , undefined,  undefined, true):

                     What am I doing wrong?