Page 1 of 1

New null layer via javascript

Posted: August 11th, 2011, 7:06 pm
by i4n
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!

Re: New null layer via javascript

Posted: August 12th, 2011, 1:23 am
by Paul Tuersley
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

Re: New null layer via javascript

Posted: August 12th, 2011, 8:56 am
by i4n
Thank you very much, Paul. I've got some reading to do!

-I4n

Re: New null layer via javascript

Posted: August 12th, 2011, 7:47 pm
by i4n
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.