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

What is Framer? Join the Community
Return to index
Jaime De Ascanio
Posted Jun 02 - Read on Facebook

Hello guys, I don't understand why the first block of code hides the layer but the second doesn't. Any tips? Thanks

6 Comments

Koen Bok

This is a classic closures problem, one of the harder parts about js: http://stackoverflow.com/questions/111102/how-do-javascript-closures-work

TLDR; change your handlers to:

layer.on Events.Click, (event, layer) ->

Jaime De Ascanio

Koen Bok thanks for your quick response, I just tried this and still does not work

Koen Bok

Allmost, let me make you an example.

Joon Won Lee

Try
this.animate > layer.animate

Jaime De Ascanio

Koen Bok thanks! that worked! but it is wierd that only works if I put the "allLayers = []" at the bottom but i already have it declared on the top of the document

Read the entire post on Facebook