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

Separate the letters of a word and put them in text areas

Community Beginner ,
Apr 11, 2019 Apr 11, 2019

Copy link to clipboard

Copied

Sorry for the mistakes of language. Text translated from French.

Hello !
I looked on the Internet, on the forums, I copied codes, but I did not succeed. Can you help me please?

Langage

html 5 JS Canvas

Context
First, I get back the current year. No problem
var myyear = new Date ();
var an = myyear.getFullYear ();
this.textyear.text = an;

Problem
I would like to put each retrieved number in a different text area to be able to animate them independently.

2 in a area text, 0 in a other area text, etc...

Thank's you very much

Views

197

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

correct answers 1 Correct answer

Community Expert , Apr 11, 2019 Apr 11, 2019

Hi.

Here is a suggestion. Basically turn the year into a string and assign each letter to a different text field.

JS code:

var year = String(new Date().getFullYear());

this.firstText.txt.text = year[0];

this.secondText.txt.text = year[1];

this.thirdText.txt.text = year[2];

this.fourthText.txt.text = year[3];

FLA download:

animate_cc_html5_canvas_year_to_text_fields.zip - Google Drive

Regards,

JC

Votes

Translate

Translate
Community Expert ,
Apr 11, 2019 Apr 11, 2019

Copy link to clipboard

Copied

Hi.

Here is a suggestion. Basically turn the year into a string and assign each letter to a different text field.

JS code:

var year = String(new Date().getFullYear());

this.firstText.txt.text = year[0];

this.secondText.txt.text = year[1];

this.thirdText.txt.text = year[2];

this.fourthText.txt.text = year[3];

FLA download:

animate_cc_html5_canvas_year_to_text_fields.zip - Google Drive

Regards,

JC

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 Beginner ,
Apr 12, 2019 Apr 12, 2019

Copy link to clipboard

Copied

Hello JoãoCésar,

I am struck by the simplicity of the solution. And yet, I searched. I'll try to see the basics of the JS.

Thank you very much for the quick answer and for the file. You're very helpful !

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 ,
Apr 12, 2019 Apr 12, 2019

Copy link to clipboard

Copied

LATEST

Excellent!

You're welcome!

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