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

What is Framer? Join the Community
Return to index
Chris Keith
Posted Jun 15 - Read on Facebook

2 questions:

1. how do i make it so that clicking on listItem switched the state of touchDot


2. how do i write my if conditional to check that when i touch a new dot to change states, it makes sure that if there is another that's already changed, it reverts it back to default when i change states on the currently clicked one

basically only one dot can be blue at a time


Blaine Billingsley

Yo Randy - I am not an expert with coffeescript, but the way I understand it, the issue is that when you go through a for loop and then use a function, all of the context of the variables in the for loop are not visible to anything inside the function. In other words, your function couldn't see each touchDot and as a result any time you clicked on an item, it would only change the very last touchDot (which is the last layer that was assigned that variable). The easiest way do do 1. is to give a name to the touchDot (something like name: "touchDot" and then traverse the layer hierarchy to find the one inside the listItem like so listItem.onClick -> @.subLayersByName("touchDot")[0]

Blaine Billingsley

For number 2 you need to get a little fancier by storing the layers in an array. Here's an example:

Chris Keith

you are a golden god. thank you so much

Blaine Billingsley

np dude!

Read the entire post on Facebook