Changing font variable


Can anyone suggest how to change the content of a font in script?

I have a text field called word which I need to change on a button press (const word = symbol.nodes.word;)

Thank you


Hello @stephen.bedser
What you can do about it is have a text node on your hierarchy and do a code like this:

symbol.nodes.btn.on("pointerup", ()=>{

In this way your text’s font will change as expected. You can do some kinda of array for this if you want so with all your mediaFiles fonts.

att, Higão.


Thanks higor :slight_smile:


@higor …looking at that, I actually want to change the text contained… so if the word displayed was say “one” I want the same text container to be changed to say “two”…can I use variables? Apologies if I’m not explaining myself right ! :slight_smile:


No worries, maybe I understand it wrong. All you have to do then is change a little part of your code, like this:

symbol.nodes.btn.on("pointerup", ()=>{
    symbol.nodes.fontRoboto.text("text what you want to change");

Try this one and tell me.

Att, Higão;


Wonderful, thanks for your help @higor!


Nice one @higor - super helpful as always.


Thank you @james.wright :smiley:

I try…

att, Higão.