• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Changing targeted layername dynamically (Syntax issue)

New Here ,
Apr 18, 2017 Apr 18, 2017

Copy link to clipboard

Copied

Hi,

I need to change targeted layer name dynamically.
This is regular path name:

thisComp.layer("layername").effect("...

I want to change the path name like:
thisComp.layer("layername"+ a value from a slider).effect("...

When i add a value like:
thisComp.layer("layername"+ 0).effect("...
thisComp.layer("layername"+ 1).effect("...
etc. it works.

But when i try to write:

x= thisComp.layer("sliderLayer").effect("nameValue")("Slider");
thisComp.layer("layername"+ x).effect("...
not working.

Do i try an invalid operation.
Or is there any way to execute it in CS5.

Thanks

TOPICS
Expressions

Views

912

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 18, 2017 Apr 18, 2017

Sliders return values, not strings. You need to include a toString() conversion.

Mylenium

Votes

Translate

Translate
LEGEND ,
Apr 18, 2017 Apr 18, 2017

Copy link to clipboard

Copied

Sliders return values, not strings. You need to include a toString() conversion.

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 18, 2017 Apr 18, 2017

Copy link to clipboard

Copied

Thank you Mylenium

I didn't know how to use toString() conversion.

I have investigated and find it.

It may help another members.


thisComp.layer("layername"+ x.value.toString())).effect("...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 18, 2017 Apr 18, 2017

Copy link to clipboard

Copied

You probably just need to change this line:

x= thisComp.layer("sliderLayer").effect("nameValue")("Slider");

to this:

x= thisComp.layer("sliderLayer").effect("nameValue")("Slider").value;

Dan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 18, 2017 Apr 18, 2017

Copy link to clipboard

Copied

LATEST

Dan Ebberts​

x= thisComp.layer("sliderLayer").effect("nameValue")("Slider").value;

not working but


x= thisComp.layer("sliderLayer").effect("nameValue")("Slider").value.toString();

is working.
And it's the best usage i think.

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines