Highlighted

Does the createjs color property work on a dynamic textfield for html-canvas

Participant ,
Jul 23, 2019

Copy link to clipboard

Copied

Hi, Folks,

I'm using a dynamic textField created on the stage of an HTML-Canvas Doc. At run time I want it to change text color on the click of a button so I used the following code:

this.myTxt.text.color = "#E25FE8";

inside a click handler. Nothing happened.

I also tried:

console.log(this.myTxt.text.color )

I got "undefined".

However, some other methods and properties do work like

this.myTxt.text = "Mucho Love".

I might be doing something wrong

Does anyone tried doing something similar?

Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

Given that you've demonstrated in your post that you're perfectly well aware that the "text" property of a dynamic textfield is a string that contains its textual content, why on Earth are you attempting to assign to myText.text.color instead of myTxt.color?

https://www.createjs.com/docs/easeljs/classes/Text.html

Views

108

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

Does the createjs color property work on a dynamic textfield for html-canvas

Participant ,
Jul 23, 2019

Copy link to clipboard

Copied

Hi, Folks,

I'm using a dynamic textField created on the stage of an HTML-Canvas Doc. At run time I want it to change text color on the click of a button so I used the following code:

this.myTxt.text.color = "#E25FE8";

inside a click handler. Nothing happened.

I also tried:

console.log(this.myTxt.text.color )

I got "undefined".

However, some other methods and properties do work like

this.myTxt.text = "Mucho Love".

I might be doing something wrong

Does anyone tried doing something similar?

Adobe Community Professional
Correct answer by ClayUUID | Adobe Community Professional

Given that you've demonstrated in your post that you're perfectly well aware that the "text" property of a dynamic textfield is a string that contains its textual content, why on Earth are you attempting to assign to myText.text.color instead of myTxt.color?

https://www.createjs.com/docs/easeljs/classes/Text.html

Views

109

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
Jul 23, 2019 0
Adobe Community Professional ,
Jul 23, 2019

Copy link to clipboard

Copied

Given that you've demonstrated in your post that you're perfectly well aware that the "text" property of a dynamic textfield is a string that contains its textual content, why on Earth are you attempting to assign to myText.text.color instead of myTxt.color?

https://www.createjs.com/docs/easeljs/classes/Text.html

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
Reply
Loading...
Jul 23, 2019 0
Lucir LATEST
Participant ,
Jul 23, 2019

Copy link to clipboard

Copied

I think you are right. I discovered my mistake earlier. Thank you for your polite reply. Have a nice day, sir

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
Reply
Loading...
Jul 23, 2019 0