After effects UI dropdownlist (Drop down list)

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
fapelbaum
Posts: 2
Joined: March 28th, 2015, 10:35 am

Hi everyone! Im really new to the scripting world and have to say I love it!

I have a question regarding a Dropdownlist. I have an after effects project with a composition loaded with team logos. I was able to create a Dropdownlist that will automatically gather the names of the layers within the comp to populate the drop down list.

then, the scripts requests to all layers be disabled (if any visible) so when one is selected from the drop down, only the selected team becomes enabled. This is the part I am having problems with, I'm not sure how to connect this part of the script with the Dropdownlist so it recognizes the selected team from the drop down to enable it.

Here is the script:
The ?????? is what I believe its missing for it to work, not sure what to write there:

var myWin = new Window("palette", "Drop down list", undefined);
var proj = app.project;
var awayComp = proj.item(2);
var homeComp = proj.item(3);
var myList = new Array();

for(var i=1; i <= awayComp.numLayers; i++){
myList[myList.length] = awayComp.layer(i).name;
}


var groupOne = myWin.add("group", undefined, "GroupOne");
var dd = groupOne.add("dropdownlist", undefined, myList);
dd.selection = 0;



dd.onChange = function() {

for(var i = 1; i < awayComp.layers.length +1;i++){
//Hides all visible layers
awayComp.layer(i).enabled = awayComp.layers.enable = false;
// check name
if(awayComp.layers.name == ??????){ //I dont know what to type here to connect with the dropdown selected team
// turn into opposite
awayComp.layers.enabled = !awayComp.layers.enabled;
}
}
};



myWin.center();
myWin.show();


Hope it makes sense! I will truly appreciate all your help!
Post Reply