This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Joshua Tucker
Posted Apr 07 - Read on Facebook

Hola everyone! Question: is there way to pass other variables with an event handler? Example:

touchHander = (event, layer, othervariable)

layer.on(Events.TouchStart, touchHandler <-- pass othervariable here)

If I were to do (..., touchHandler(other variable)), it just executes the function when I am setting up the handler.

Cheers!

4 Comments

Koen Bok

Not like this. I'd recommend using a closure in coffee script like this: http://stackoverflow.com/questions/11869270/coffeescript-do-pass-argument

(advanced)

Joshua Tucker

Koen Bok Thanks Koen, I'll check it out.

Jordan Robert Dobson

Nice. I've wondered that before as well. Post an example here when you get an example together Joshua.

Joshua Tucker

Jordan Robert Dobson Will do!

Read the entire post on Facebook