Dynamic text HTML5

New Here ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

Hi everyone,

I am slowly going from Flash/as3 to Canvas/Javascript and I have a newbie problem with dynamic texts.

I have a dynamic text on the stage instanced as T_Counter and I simply want to change its text property.

I tried the basic :

this.T_Counter.text = "This is a test"; and nothing shows

I tried with a variable :

var ceTexte = "This is a text";

this.T_Counter.text = ceTexte; and nothing shows

It's a bit frustrating to be unable to perform such a basic task !

Thanks in advance for any hint !

TOPICS
Discussions

Views

1.6K

Likes

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

Adobe Community Professional , Aug 15, 2019 Aug 15, 2019
Is advanced layers enabled? Check your document settings: If using advanced layers, each layer will be translated to a movieclip on publish, so you must be specific: this.Later_Name.T_Counter.text = "new text";

Likes

Translate

Translate
Adobe Community Professional ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

Is advanced layers enabled? Check your document settings:

If using advanced layers, each layer will be translated to a movieclip on publish, so you must be specific:

this.Later_Name.T_Counter.text = "new text";

Likes

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
Explorer ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

Do you really mean "Layer_Name" instead of "Later_Name" ?

Likes

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
Adobe Community Professional ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

A true mystery!

Likes

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 ,
Aug 15, 2019 Aug 15, 2019

Copy link to clipboard

Copied

Thanks for your answer Joseph, it was the problem.
It seems that I have a lot to learn. The scope of the variables and the way you adress an object seems to be different enough from what I'm used to in as3.
Anyway, I found that event.currentTarget stands for event.target in as3 so I'll find my way out of this mess. lol.

Thanks again !

Likes

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 ,
Jul 16, 2020 Jul 16, 2020

Copy link to clipboard

Copied

Sorry, but doesn't work for me. (HTML5 canvas in Animate (V 20.5))

While rotation of this text field works (regardless of  adding the layer or not) the text does not:


var _this = this;
_this.SwitchText.on('click', function(){
//_this.Label_Clearpoint.rotation+=45;
//_this.Partikel.Label_Clearpoint.text="ABC";
_this.Partikel.Label_Clearpoint.text="ABC";
});

Likes

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 ,
Jul 16, 2020 Jul 16, 2020

Copy link to clipboard

Copied

LATEST

Problem solved, I found the solution:
I had changed the dynamic text to a movieclip which was not necessary.
Dynamic text already has a label so it can be addressed directly.

Likes

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