I created a loop to create 11 layers in my prototype.
Now I want to give all 11 layers the same scrolling and dragging properties and also a unique name/id because later I need to know the x and y position of every single layer.
The code that I have right know is what I want to do and of course with this code only the latest created layer gets the scrolling properties.
I tried to include those things in the loop but I cant get it to work properly.
you have to put the draggable properties within the for loop. indent whatever properties you want for the 'layer' so it's contained in the loop and it should work http://screencast.com/t/767rAs47HBE
I tried that, but as I said I get Errors with it :(
Exact Error: TypeError: undefinied is not an object (evaluating this.draggable.enable = true)
defining layer properties don't take 'this' dot notation syntax. you can only do that for events/functions/etc (i believe?). You indented too far and you have to use the layer name
Thats the thing, layer.draggable.enable = true does also not work. And I cant find out how to give every single layer a unique name in the loop :)
look at the example. your draggable/scroll properties can't go in the layer properties. http://share.framerjs.com/k1drsxdygk9w/
Aalok THANK YOU SO MUCH :) It works perfect. I thought I even tried that but I probably was in the wrong scope (im not used to the white space type of programming :D (bad excuse).
Also the naming works :) really cool! :)
For the unique values, maybe create a simple array or an array of objects, the loop through that. Each element in the array would correspond to one of the layers you want to create, and could hold the unique properties. https://medium.com/framer-prototyping/code-less-achieve-more-with-arrays-in-framer-c43594d13d59#.97e0kwkpm