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

What is Framer? Join the Community
Return to index
Sergey Perepelkin
Posted Aug 29 - Read on Facebook

Hello, guys!
I want to use Classes in my work. For example, create Class that includes Navigation Bar and Content Spaсe. All other elements I want to put inside Content Space. But it writes that Content Space is not defined, when I'm trying to use it outside the class (for parenting). Help!
I don't have framer studio so there's link to my example http://sergeylask.ru/framer/class-problem/ and there's to my coffeescript file http://sergeylask.ru/framer/class-problem/app.coffee.

3 Comments

John Lee

hey Floris Verloop, thanks for the example.
I have two questions:
1. how can i assign states to the children of the parent through a function.
I'm trying to do this, but it doesn't lend itself to calling the layer just by its name
addStates = (layer) =>
__layer?.states =
____layer.children[1].states =
_____hide:
______opacity: 0

addStates(myLayer.children[0]

2. when I create a new screenComp, but i didn't want @navBar or other children in the Layer how can I assign them to null?

Floris Verloop

Hey Sergey,

This is because your navBar and contentSpace layers are only available in the constructor function of your class. This is a scoping issue.

In order to make the Layers available as a property of your class, assign them to "this". You can do this by adding an "@" to the layer names. You can then access the layers like any property: "CourseSc.contentSpace".

Here's an example: http://share.framerjs.com/kby6pff5v90g/

Sergey Perepelkin

Floris Verloop, It works! Thank you very much!

Read the entire post on Facebook