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

What is Framer? Join the Community
Return to index
David Louie
Posted Jul 20 - Read on Facebook

When I try to use "@" or "this" to refer to scroll component it doesn't seem to work. I want to store a bunch of scroll components in an array and bind events to each one using the "@" method. Any ideas? Hopefully this is clear.

myscroll.onMove ->
print myscroll.scrollY # this works
print @.scrollY # this doesn't work


Brian Williams

are you extending it?

Brian Williams

also context might help. if you open a new test project or an empty project with just a scroll component does it still break?

When I test it it seems to be referencing the layer correctly

Edit: see below

Brian Williams

oh wait I get it, its because this is the content object inside the scroll component... this.parent is the scroll component.

David Louie

Wow thanks so much Brian Williams @.parent.scrollY gets me the amount of scroll. Weird that it doesn't really match the documentation though, no?

Koen Bok

This is a typical hard thing about javascript: this. In a nutshell it changes depending on what calls it. You can fix it by "binding" it, replace the -> with a fat arrow =>.

For a full explanation:

Read the entire post on Facebook