AE ENHANCERS

Expressions/Scripts/Presets
It is currently Fri Nov 21, 2014 10:27 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Dropdown Menu listing all layers in active comp
PostPosted: Sat Feb 26, 2011 12:49 pm 
Offline

Joined: Tue Jan 05, 2010 1:37 am
Posts: 12
Hi,

This request seems simple but I haven't seen an example of what I am looking for anywhere. I have a UI where I want to create a dropdown box listing all the layers in the comp. I think I know how to get the dropdown created, but I am not sure how to generate an array of all the layer names.


Top
 Profile  
 
 Post subject: Re: Dropdown Menu listing all layers in active comp
PostPosted: Fri Mar 04, 2011 3:55 am 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 698
Location: London, UK
Here's some code that won't work on its own, but should give you some ideas. The layerNameArray stuff shows how you could create an array of layer names. The palette stuff shows how you might implement adding items to a drop down. I imagine that this is something that will need refreshing, so you could first do a removeAll to clear out the list, then loop through the layers adding a new list item for each name.

Code:
{
   var activeItem = app.project.activeItem;   
   if (activeItem != null && activeItem instanceof CompItem) {
      
      var layerNameArray = new Array();   
      palette.dropDown.removeAll()   
      
      for (var x = 1; x <= activeItem.numLayers; x++) {
         //$.writeln(activeItem.layer(x).name);   
         layerNameArray.push(activeItem.layer(x).name);
         palette.dropDown.add("item", activeItem.layer(x).name);
      }
   }
         
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group