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

HTML5 Canvas / using html code in dynamic textfield

Participant ,
Feb 11, 2019 Feb 11, 2019

Hello, and first sorry for mu english
I am trying o make a animation with dynamic text field, everything work with simple text, but when I want to manipulate a text with html code it doesn't work

My code

info = "<b>Hello</<b>";

myTextField.text = info; ///doesn't format my text

myTextField.htmlTxt = info; ///doesn't format my text

I am making that in a HTML5 Canvas

Thanks for your help !

8.2K
Translate
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 , Feb 11, 2019 Feb 11, 2019

Hi.

Animate regular text fields are canvas based. So you cannot style text using HTML tags.

This is a canvas limitation.

And that html option for text field is greyed out because it only works in AS3 documents.

If you want HTML formatting, you can use a Label component (Window > Components).

Then you can change the text like this:

setTimeout(function()

{

    dom_overlay_container.children[0].innerHTML = "<b>Hello</<b>";

}, 0);

Then you wrap this label component inside of a Graphic or Movie Clip symbol for

...
Translate
Participant ,
Feb 14, 2019 Feb 14, 2019

Thanks so much JC, I really appreciate, it works and it will be more easy for me to understand by looking at your code

@Klaus, thanks for your explanation and you time too, I don't have your level in Animate CC, and in html in general, your explaination are rellay helpfull

Regards

Translate
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