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

Moderators: Disciple, zlovatt

Post Reply
Simma
Posts: 98
Joined: June 8th, 2010, 2:57 pm

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?
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

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
Simma
Posts: 98
Joined: June 8th, 2010, 2:57 pm

Really? So I can't have a slider that changes the (1) value to (2) for example?
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

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;
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

Sorry, I misread your question. Paul's solution will work for you.

-Lloyd
Simma
Posts: 98
Joined: June 8th, 2010, 2:57 pm

That worked perfectly! Thank you for taking the time :)
Post Reply