New null layer via javascript

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
i4n
Posts: 14
Joined: July 8th, 2011, 3:52 pm

Hi,

I posted this in script requests earlier, but this forum seems more appropriate...
I'm attempting to create a new null layer in my project but can't find documentation on the correct name to call for one.

Here's what I have tried (doesn't work):
var newRepoLayer = myComp.layers.addNull([0,0,0], "Repo", myComp.width, myComp.height, myComp.pixelAspect, myComp.duration);
newRepoLayer.visible = false;

The major problem being that '.addNull' was purely a guess.

BONUS QUESTION- newRepoLayer.visible = false; doesn't work for turning off the visibility of new layers. Can someone please tell me what I am doing wrong? I've attempted to find the answers to these questions on my own, but there are virtually no resources (helpful, anyway) that I've found.

Help me AENHANCERS, you're my only hope!
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

You want the LayerCollection addNull() method. Page 94 of the CS3 scripting guide.
You only specify a duration, so usage is: layers.addNull(duration)

And for turning layers on/off you want the Layer enabled attribute. Page 86 of the scripting guide.

AE CS3 Scripting Guide
i4n
Posts: 14
Joined: July 8th, 2011, 3:52 pm

Thank you very much, Paul. I've got some reading to do!

-I4n
i4n
Posts: 14
Joined: July 8th, 2011, 3:52 pm

Looked up those pages in the reference you linked me to and was able to find everything I needed to get my script working the way I had envisioned. Thanks again.
Post Reply