How to return name value from Drop Down Menu?

Community Beginner ,
Jun 18, 2020

Copy link to clipboard

Copied

Hi

 

How do I return the actice name value from a Drop Down Menu? Not the item#, but the name.

The selected names correspond with layer names - and I would like to call them, depending on which item that is chosen.

Fx:

menuName = effect("Target Country")("Menu");

thisComp.layer(menuName).sourceRectAtTime().height;

TOPICS
Expressions, How to

Views

81

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Explorer ,
Jun 18, 2020

Copy link to clipboard

Copied

Pretty sure you can't but the work around would be to write an array in the same order as your dropdown list then use that and the dropdown to pick the array number. Like this:

menuItems = ["Layer name one", "Layer name two", "Layer name three", "Layer name four"];
menuName = effect("Target Country")("Menu").value;
thisComp.layer(menuItems[menuName - 1]).sourceRectAtTime().height;

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Tigerdyr13 AUTHOR LATEST
Community Beginner ,
Jun 22, 2020

Copy link to clipboard

Copied

Thank you Greg1987! I used your suggestion.

 

I do wish I could retrieve the menu item names somehow - this way it would also serve as a global array of names, which I could use in any layer. Now I need to update several layers, if I add or remove an item from the menu.

 

Thanks again! 🙂

Likes

Translate

Translate

Report

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