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

What is Framer? Join the Community
Return to index
Will Anderson
Posted Jul 26 - Read on Facebook

Hi all, Trying to create a function that changes the attributes of other layers in my prototype (e.g., you click on a button, the function triggers and changes the background color of the prototype).

In order to make it as flexible as possible, hoping to pass the target layer, as well as the target attribute, through the function each time. But the attribute (in this case, its backgroundColor) isn't a recognized variable. And if include it as a string, Framer doesn't recognize it. Anyone have a suggestion on how to make this work?

Attached an example to illustrate the problem


Radek Kyselý

Dot notation only works for the exact hard-coded name of the key. That means here it actually looks for 'attribute' key on the layer.

Use square brackets instead and pass the key you want to change as a string :)

Read the entire post on Facebook