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 13 - Read on Facebook

Got a quickie here:

Best way to return an items array index value and pass to a function?

myFunction = (buttonIndex) ->
do something with buttonIndex here

myButtons = [
buttonOne
buttonTwo
buttonThree
]

for layer in myButtons
myFunction(buttonIndex)

Just trying to determine the index of a button that was clicked last and pass to myFunction.

Thx in advance!

4 Comments

George Kedenburg III

do this: `for layer, i in myButtons` and then i will be the index

Brian Byle

To return the index of the last button clicked, I tried :

print this.i but it returned UNDEFINED. Ideas?

Brian Byle

Thx Marc!

Read the entire post on Facebook