• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

HTML5 canvas and multilanguage with i18next

New Here ,
Dec 13, 2021 Dec 13, 2021

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

Views

179

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2021 Dec 13, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 13, 2021 Dec 13, 2021

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 !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2021 Dec 13, 2021

Copy link to clipboard

Copied

LATEST

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

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines