FORUMS: list search recent posts

# Problem with the order of actions. how to create a slider without losing the original property selection array

FAQ   •   VIEW ALL
 Problem with the order of actions. how to create a slider without losing the original property selection array on Dec 12, 2016 at 12:33:51 amLast Edited By Tal Arbiv on Dec 12, 2016 at 10:46:06 pm

I've got a double 'for' loop creating expressions on a selected properties of selected layers. the expression contains reference to a slider that is created on current layer within the same loop.
problem is, if i place the slider creation after the expression assignment, the non existing reference breaks the loop,
and if i place it after, my guess is that it replaces the active selection of the original property with the newly created slider and that messes up the rest of the loop .

result 1 : faulty expression
result 2 : expression assignment skipped

// (1) :

expr = "effect('name')('slider') //+something+something.... ;
for (i=0; i <= sellayers.length-1; i++){
for (p=0; p <= selprop.length-1; p++){
selprop[p].expression = expr;
}
ofset.name = "name";
ofset.property("Slider").setValue(0);
}
// (2) :

expr = "effect('name')('slider') //+something+something.... ;
for (i=0; i <= sellayers.length-1; i++){

ofset.name = "name";
ofset.property("Slider").setValue(0);

for (p=0; p <= selprop.length-1; p++){
selprop[p].expression = expr;
}
}

```// (1) : expr = "effect('name')('slider') //+something+something.... ; for (i=0; i &lt;= sellayers.length-1; i++){ for (p=0; p &lt;= selprop.length-1; p++){ selprop[p].expression = expr; } ofset = sellayers[i].Effects.addProperty("ADBE Slider Control"); ofset.name = "name"; ofset.property("Slider").setValue(0); } // (2) : expr = "effect('name')('slider') //+something+something.... ; for (i=0; i &lt;= sellayers.length-1; i++){ ofset = sellayers[i].Effects.addProperty("ADBE Slider Control"); ofset.name = "name"; ofset.property("Slider").setValue(0); for (p=0; p &lt;= selprop.length-1; p++){ selprop[p].expression = expr; } } ```