Renaming a Slider or Dropdown

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
CharlieL
Posts: 1
Joined: May 2nd, 2020, 9:19 pm

So the code I'm working with (full code below!) works, I just don't understand - on the last line, why does

Code: Select all

property(1)

need to be a parent of

Code: Select all

propertyGroup(1)

When I take either one out or shuffle them around, the code no longer works, so it must be important, I just don't understand why. Can anyone explain? In plain English - what are those two referring to and why in that order? Thanks!!

Full code:

Code: Select all

var myComp = app.project.activeItem;
boxLayer = myComp.layer(1);

var dropdownItems = [
    "Item 1",
    "Item 2",
    "Item 3"
];

var boxLayerDropdown = boxLayer.Effects.addProperty("ADBE Dropdown Control");
var temp = boxLayerDropdown.property(1).setPropertyParameters(dropdownItems);
temp.propertyGroup(1).name = "This Is My New Dropdown Name";

var boxLayerSlider = boxLayer.Effects.addProperty("ADBE Slider Control");
var temp = boxLayerSlider.property(1).propertyGroup(1).name = "This Is My New Slider Name";
User avatar
James VM
Posts: 7
Joined: October 29th, 2018, 11:50 pm

Change to

Code: Select all

var temp = boxLayerSlider.name = "This Is My New Slider Name";

You don't need either of them because property(1) is selecting the first property of the slider (moving down in the hierarchy) and propertyGroup(1) is moving up the hierarchy, back to where you were before.

The strange thing is, I now find setPropertyParameters(dropdownitems) no longer works in AE2020!

Post Reply