Can I use variables to access imported Sketch layers? Example:
Artboard 1 Layer A Layer B
sketch.layerArray[layerIndex].style.outline = "1px solid red"
Currently, when I try to do that I get a TypeError: undefined is not an object (evaulating 'sketch.layerArray[layerIndex.style]
When I'm trying to do is to dynamically change layer's outline when users press a key.
layerArray is not sketch object, so u can't call it like that . also dont use "" for adding layers into array,cause array will just contay strings
layerArray=[Layer_A,Layer_B] print layerArray[layerIndex]
more on topic https://medium.com/framer-prototyping/code-less-achieve-more-with-arrays-in-framer-c43594d13d59#.u2boqxpgn
Thanks, indeed the array need to be holding objects i.e. Layer_A not strings "Layer_A". It's always good to watch for the parenthesis :)