Fill color of shapes in layer
How can i fill the color (solid) of shapes within an layer? For now I got:
function getLayer(name)
{
return app.activeDocument.layers.getByName(name);
}
function fillSelection(hex)
{
var layer = getLayer('Background');
app.activeDocument.activeLayer = layer;
app.activeDocument.selection.selectAll();
var selection = app.activeDocument.selection;
var sColor = new SolidColor;
sColor.rgb.hexValue = hex;
app.activeDocument.selection.fill(sColor);
app.activeDocument.selection.deselect();
}
But this is not working if i create a rectangle in the "Background"-Layer. (even not if its converted to smart object or rasterized...).
Thank you!
