For loop only ones because layers.add, why?
I have some layers, and I want to add, from the project stack, a null before each layer so I type this:
#target aftereffects
var theComp = app.project.activeItem;
var theLayer;
var dummyNull;
var dummyLayer;
{
for (var i = 1 ; i <= app.project.numItems; i++)
{
if (app.project.item(i).name == "DUMMY") dummyNull = app.project.item(i);
}
for (var k = 0; k < theComp.selectedLayers.length; k++)
{
theLayer = theComp.selectedLayers
; dummyLayer = theComp.layers.add(dummyNull);
dummyLayer.moveBefore(theLayer);
//THIS LOOP ONLY RUNS ONES, WHY?
}
}
why does only do one loop?