Help! I am struggling to create a loop inside of a loop. Only the last 'square' is triggering the event. How can I assign the event to each 'square'?
Thank you in advance.
array = ["01","02","03", "04"]
for squares in array
layer = new Layer y: 102 * squares backgroundColor: "white"
for each in array layer.on Events.Click, -> layer.backgroundColor = "Red"
Could you share? Otherwire, try to do "for each in arraySuperLayer.subLayers"
Anton Jarl http://share.framerjs.com/hytt3nbaufhw/
layer is overridden during each assignment. Inside the event scope you can refer to self to get the right layer. Shorthand for self is the @ symbol. http://share.framerjs.com/m07xs4cpoo7m/
Jonas Treub What about if the hit area is a different layer? Let's say I need to click in a different layer to toggle between states on another element. By the way, thank you for the help so far.
Jonas Treub http://share.framerjs.com/66z03dx6bdrk/
Than the variable holding that layer needs to be unique. You could also store the linked layer as a property on the interactive layer like so: http://share.framerjs.com/kib9jyz9niad/
Diego - you could also give your layers a name property and append a unique number in the for loop.
Jonas Treub This is interesting. What else can be stored as a property? Is there any documentation for that? Thank you Jonas.