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
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", ()=>{
symbol.nodes.fontRoboto.font(symbol.mediaFiles.Blackout_ttf)
});
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
@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 !
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;