I have a bunch of layers that are basically list items. Imported from Photoshop. Each item is a group. I can get a click when I use offersLayers.item1.on EventsClick etc, but I'll like to loop to add the click listener as so
offersLayers = Framer.Importer.load "imported/offers"
for k, v of offersLayers v.on Events.Click, -> onOfferSelected(event, layer)
onOfferSelected = (event, layer) -> print layer.name
When I do this I get ReferenceError: Can't find variable: layer. Is there not a way to do this?
Hey Brent Bonet, there is, but you need to use "v" as the function argument within your click event, on "onOfferSelected". Otherwise, within your layer event, you're never actually targeting the layer from within your loop.
Here's an even easier way to accomplish this. :-)