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?_______________
button1.on Events.Click, -> exampleLayer = new Layer
button2.on Events.Click, -> exampleLayer.animate 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?
Initialize the variable outside of the function. Before your code add: exampleLayer = null
(See "Local Scope")