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

What is Framer? Join the Community
Return to index
Scott Simpson
Posted Aug 20 - Read on Facebook

How can I destroy dynamically created layers?
I am trying to call layer.destroy() on a click handler, but I don't think the layer is available in the scope.


Amrit Mazumder

The coffeescript experts in the group will have a better answer but this is working for me (basically overwriting a global variable)

Trevor Phillippi

^this is correct

Marc Krenn

Kevyn Arnott

You can indent the btn event, and it'll work

Kevyn Arnott

Probably the better longterm fix is to create the modal as btn.modal, and then the modal will be in scope, and you can use this.modal.destroy(), or you can use btn.modal.destroy() whatever you want to do.

Scott Simpson

Thanks for all the help!

Read the entire post on Facebook