Changing Text of a button

Hi,

I’m lost … I want to do a simple operation: to change the text of a button.

I tried several things and finally:

buttonTeam1.buttonText.setText(“Team1”)

but this ends up again in the error: “setText() can only be used with text objects.”

I found an other post in this forum from 2021 with exact this solution. Is this not possible anymore or is there an other possibility to change the Text of a button?

I could not find anything about this in the tutorial, so I would appreciate some help very much.

Thank you!

Sven

try this instead:

buttonTeam1.buttonText._children[0].setText("Team1")

This means that the object you’re trying to set text to isn’t a text object. I’m guessing it’s a text object that was turned into a clip. When you use the text tool to write on the canvas, the text you write counts as a text object by default, so you don’t need to click “make clip” or “make button” to name it, you should be able to name it by simply selecting it and writing a name in the inspector. Then you should use that name with the setText function.

Once you turn the text object to a clip, you can’t set the text of the clip because a clip isn’t a text object, but rather a group of other objects.