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

What is Framer? Join the Community
Return to index
Dennis Hatwieger
Posted May 01 - Read on Facebook

Hey lovely Frameristas,

just a super short question.
I want to change text of a textLayer from a function.

I tired something like this and as you might guess it doesn't work:

Would love to hear from you


Patryk Adaś

button.onClick (event, layer) ->
theBestText.text = "bar" ## ??????

Dennis Hatwieger

Patryk Adaś nice, thanks a lot. Is there a way to access/change the variable though?

Jordan Robert Dobson

If you want to change both at the same time...

button.onClick (event, layer) ->
theBestText.text = content = "bar"

Alex Boschmans

In your code you create a variable "content" and assign it "foo". Then you create a text layer and assign its text variable whatever is in "content".
So far so good. But this only happens once and not continually. So if you now change again "content" to hold "bar" this will not change the theBestText.text. You will need to again set theBestText = content to update it.

Dennis Hatwieger

thanks a lot Alex

Read the entire post on Facebook