JSX - Referencing Layer(s) Syntax Question
Hi everybody,
So I'm breaking to learning how to use the script "generator" (ScriptListener/CleanSL) and learning why errors keep coming up with common code. I'm used to working in Flash/Animate and CSS/JS errors in web pages. Sourcing errors in this environment is a little less intuitive for me so pardon the persistent questions...
I pulled a script from an expert, I've dumbed it down. It looks simple enough, but not knowing this environment well I'm not sure why it doesn't run.
var aDoc = documents.add();
var aLay1 = aDoc.layers.add();
var subLay2 = aLay1.layers.add();
The second line creates an error: Error 1302: No such element
Now, I pulled another code from the scripting guide and it works fine:
var aDoc2 = documents.add();
var aLay1 = aDoc2.artLayers.add()
textLayerRef.name = "my text"
textLayerRef.kind = LayerKind.TEXT
I don't imagine the first is a deprecated version of layer referencing as I also found this in the guide as well:
layers["Layer 3"].name
//using the collection name and square brackets for the collection
Layers looks pre-defined and is treated like an array object as far as I can tell, but these layers log out as 'undefined' and typeOf tells me it's not a function. So...I'm trying to figure out what's wrong form for the first set of layer building.
Both try to add(), but only the latter works. Is 'artLayers' just a new school thing for 'layers'?
Thanks for reading.





