This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Brian Byle
Posted Jul 20 - Read on Facebook

Hello again. Another quickie...

-Creating an array, from layers in Sketch
-Sketch layer structured is:
myFolder
child1
child2
child3

-I create a blank array with:
myArray = [Sketch.myFolder.children]

-print myArray instanceof Array returns true
-print myArray.length returns "1"

I would think myArray.length should return "3", the total number of child layers.

Ideas?

Thx in advance, stuck here.

4 Comments

Brian Williams

children is already an array you are making a 2d array with one value in it.

just access children directly

Brian Byle

Best way to achieve the result of pushing those 3 children layers into myArray?

I always type each Sketch layer name manually in Framer when making arrays. Looking for a way to pull in those already existing names.

Rob Byrd

myArray = []
for i in Sketch.myfolder.children
--myArray.push[i]
print myArray.length

Brian Byle

Thx!

Read the entire post on Facebook