Changing color of text programmatically

Mar 04, 2015

Hello

I have looked for answers in the forum and the net but could not find what I was looking for. I want to change the color of a text (or use strikethrough) by embedding html commands into strings generated by javascript and sent back to the player for display in a textbox. So far, I have been able to make <b> and <i> work but I have not been able to change colors or use the <strike> command to strikethrough text.

I must be missing something. Any ideas would be welcome.

Thanks

Andrew

6 Replies
Mark Ramsey

Andrew, 

When you use a Javascript string to render text in a variable embedded in a Text Box, you have only a limited sub-set of HTML that you can use if you are trying to publish to Flash. If you are publishing to HTML you have a wider range of mark-up at your disposal.

Here's a link that will give you what's available when publishing to Flash:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#htmlText

Example:

I have a text variable defined within Storyline, called theText.

I embed theText into a slide: %theText%.

I set up a trigger that fires when the timeline starts (or anywhere along the timeline):

var filler = "<span><font color='#FF0000'>Hi</font> Mark</span>";

var player = GetPlayer();

player.SetVar("theText",filler);

This renders the text wrapped by the <font> markup in red. You need to use hex numbers to describe colors to make this work for both Flash and HTML5.

HTH.

This discussion is closed. You can start a new discussion or contact Articulate Support.