Copy link to clipboard
Copied
Hi everybody
I would like to know if it's possible to dynamically change the text in a canvas in javascript. I need to create a multilanguage animation with a language switcher.
I know how to to this with static code and i18next but I cant find how to do it with canvas.
Thanks
Copy link to clipboard
Copied
use a dynamic textfield
assign it an instance name (eg, tf)
if you're coding on the timeline that contains tf, use:
this.tf.text = "english";
to assign text.
Copy link to clipboard
Copied
Thanks @kglad
I use a dynamic textfield with an instance name. Can you explain me what do you mean by "coding on the timeline" ? Coding in the js file generate by animate ? I'm pretty new with animate, a whole world to discover !
Copy link to clipboard
Copied
you can add your own code to do things like assign text to textfield. if the textfield were in a movieclip (eg, with instance name mc on the main timeline), you would use:
this.tf.text = "eng"; // on mc's timeline
and
this.mc.tf.text = "eng"; // on the main timeline