Get layer from selected property?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

How can I determine what layer a property is applied to? I have tried the .parentProperty attribute but I can't seem to get it to work. Anyone have any pointers on this? Thanks.
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

OK, I found the answer. I wasn't going up high enough in the hierarchy. You can stack the parentProperty attribute.

Code: Select all

var comp = app.project.activeItem;
var mask = comp.selectedProperties[0];
maskLayer = mask.parentProperty.parentProperty;
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

You can also navigate back down the property heirarchy using property.propertyGroup(). This will give you the layer object from any property:

Code: Select all

theProperty.propertyGroup(theProperty.propertyDepth)
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Thanks Paul, that is good to know.
Post Reply