Page 1 of 1

thisComp.layer(slider control).name - how?

Posted: October 1st, 2010, 5:24 am
by Simma
Probably very easy, but I haven't gotten it to work yet. I have a comp has a null with an slider control and a text layer with the "thisComp.layer(1).name" expression on the source text.

I would like to update the selected layer (1), via the slider control, but it won't let me do this with just parenting.

Tips?

Re: thisComp.layer(slider control).name - how?

Posted: October 1st, 2010, 6:50 am
by lloydalvarez
That is not possible via expressions. One workaround way to do it could be to have several layers and have the slider change the opacity of the layers to show and hide them.

-Lloyd

Re: thisComp.layer(slider control).name - how?

Posted: October 1st, 2010, 7:15 am
by Simma
Really? So I can't have a slider that changes the (1) value to (2) for example?

Re: thisComp.layer(slider control).name - how?

Posted: October 1st, 2010, 8:38 am
by Paul Tuersley
I think this maybe what you're asking for:

Code: Select all

slider = Math.floor(thisComp.layer("Null 1").effect("Slider Control")("Slider")); // ensure slider is an integer
slider = Math.max(1, Math.min(thisComp.numLayers, slider)); // ensure index is valid, clamped between 1 to numLayers
thisComp.layer(slider).name;

Re: thisComp.layer(slider control).name - how?

Posted: October 1st, 2010, 9:41 am
by lloydalvarez
Sorry, I misread your question. Paul's solution will work for you.

-Lloyd

Re: thisComp.layer(slider control).name - how?

Posted: October 1st, 2010, 3:56 pm
by Simma
That worked perfectly! Thank you for taking the time :)