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

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

I am attempting to set a layer to be draggable, but I'm encountering this problem:

"TypeError: 'undefined' is not an object (evaluating myLayer.draggable.enabled = true')"

Not sure how to fix this issue – any ideas? Possible improper reference to Framer.js or something?

The project is being previewed by Safari via Cactus (using Koen Bok's template).

Thanks!

8 Comments

Koen Bok

It looks like myLayer doesn't exist. Paste this:

myLayer = new Layer({x:100, y:100})
myLayer.draggable.enabled = true

Joshua Tucker

I pasted it in and now I'm receiving a "ReferenceError: Cannot find variable: Layer."

Min-Sang Choi

Joshua Tucker did you erase/comment out everything and paste the code above? mine is working just fine with that way. If you're on coffee script,

myLayer = new Layer x:100, y:100
myLayer.draggable.enabled = true

will work too.

Joshua Tucker

Min-Sang Choi Yeah, I did. In fact, the only thing in the coffeescript file is what you said above. Still receiving the same error.

Koen Bok

Are you maybe using Framer 2?

Joshua Tucker

Koen Bok Apparently I was :). Didn't check the version. Huge thanks, I would have had no idea where to begin or look.

I believe the CactusTemplates you have up on Github have Framer 2.0 still then.

Koen Bok

Ah yes they are. I'm very sorry for the confusion.

Joshua Tucker

No problem at all. I learned something either way! Thanks for your help.

Read the entire post on Facebook