0

I've been trying to create a loop via a dummy array on a design list element from the design tab. I see the array is being loaded in the loop. I can't seem to put the list items below each other.

After trying to fix it for a long time, can someone point out what I'm doing wrong?

for title in titleArray
    newItem = titleArray[title] = listItem.copy()
    newItem.y=(newItem.height)*title+58

    newItem.parent= scroll.content
    listItem.parent = scroll.content

https://framer.cloud/QdVJT

Risadinha
  • 16,058
  • 2
  • 88
  • 91
Marb
  • 1
  • 1

1 Answers1

0

When iterating over the array, you will get the elements of the array instead of the indexes, to get the index, you can add another variable after a comma:

for title, index in titleArray
    newItem = listItem.copy()
    newItem.y = newItem.height * index
    newItem.selectChild("fieldTitle").text = title

Full example here: https://framer.cloud/BAnEq

Niels
  • 771
  • 5
  • 5