Skip to main content
EmbussyBus
Participating Frequently
February 3, 2021
Answered

Importing external text using xml

  • February 3, 2021
  • 4 replies
  • 489 views

Hi Guys,

I've managed to import text into a .fla (canvas) dynamic text box but I can't get <strong> or <italic> to work, the text stays regular.

Is there a way to mark up the text so individual words in a sentence are bold and italic?

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

     

    Dynamic text fields created by the Text Tool (T) are canvas based texts. And characters in canvas texts can't be styled individually.

     

    The easiest solution will be to use a Label component (Window > Components (Ctrl/Cmd + F7)) which renders DOM labels. In this way, you could, for example, style your text like this:

    setTimeout(function() // the timeout is needed to access components when the code is iniatialized
    {
    	var labelInstance = document.getElementById("yourTextID");
    	labelInstance.innerHTML = "This is a <strong>strong</strong> word and this is an <i>italic<i/> word.";
    }, 0);

     

    I hope this helps.

     

    Regards,

    JC

    4 replies

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    February 3, 2021

    Hi.

     

    Dynamic text fields created by the Text Tool (T) are canvas based texts. And characters in canvas texts can't be styled individually.

     

    The easiest solution will be to use a Label component (Window > Components (Ctrl/Cmd + F7)) which renders DOM labels. In this way, you could, for example, style your text like this:

    setTimeout(function() // the timeout is needed to access components when the code is iniatialized
    {
    	var labelInstance = document.getElementById("yourTextID");
    	labelInstance.innerHTML = "This is a <strong>strong</strong> word and this is an <i>italic<i/> word.";
    }, 0);

     

    I hope this helps.

     

    Regards,

    JC

    EmbussyBus
    Participating Frequently
    February 4, 2021

    Thank you JC,

    My solution is to import an external .js file with the text and load it into a Label component, as you suggested, that's styled using a CSS component.

    Works like a charm, not sure how I create a table that way yet but I can now start using Animate instead of Hype.

     

    Really appreciate your help

    Ben

    EmbussyBus
    Participating Frequently
    February 3, 2021

    I want to transfer from Hype 4 and this is the only thing stopping me.

    If anyone knows how I can add bold and Italic to individual words in a paragraph I'd really appreciate it

    Joseph Labrecque
    Community Expert
    Community Expert
    February 3, 2021

    Canvas works differently than markup (thank goodness). 

    EmbussyBus
    Participating Frequently
    February 3, 2021

    Hi Joseph, Thanks for your reply, I'm taking from your reply that you don't know if its possible or you don't know of a solution?

    Joseph Labrecque
    Community Expert
    Community Expert
    February 3, 2021

    With AS3 there is... but probaly not so applicable these days: 
    https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextFormat.html