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

What is Framer? Join the Community
Return to index
Nick Bewley
Posted Mar 27 - Read on Facebook

It looks like if you create a new Layer variable within an Event, that you cannot access that variable within other events.. How do people handle this?

For example:

button1.on Events.Click, ->
exampleLayer = new Layer

button2.on Events.Click, ->
properties: .....

Results in an error "Can't find variable: exampleLayer" ...


I realize that I can create the exampleLayer before and hide it, but are there any other approaches here?


Koen Bok

Initialize the variable outside of the function. Before your code add: exampleLayer = null

(See "Local Scope")

Nick Bewley

Awesome thanks!

Read the entire post on Facebook