Regular and bold font in the same text field of flash template


What would be the best way to achieve the case of using regular and bold text in the same textfield of flash template? For example, I need to be “Name Surname” aligned left, but Surname needs to be in bold (Name in regular). I have tried using htmltext with bold tags, but it looks like CasparCG does not support it. It only works on Flash/Animate preview.


That’s not true, the problem is, that you need to setup the htmltext property “by hand” in your SetData() function, as otherways Caspar sets the text property and that does not support HTML.


Thank you Didi. I had a doubts it could be the case you have explained. The only thing left is to figure it out how to properly setup the property as htmlText in SetData() function :slight_smile: Do I need to override it somehow?


OK, I am trying to approach the solution. This is the code:

package {
        	//import flash.display.MovieClip;
        	import se.svt.caspar.ICommunicationManager;
        	import se.svt.caspar.IRegisteredDataSharer;
        	import se.svt.caspar.template.CasparTemplate;
        	import se.svt.caspar.template.components.CasparTextField;

        	public class DemoTextChange extends CasparTemplate {
        		private const customParameterDescription:XML = 
        		<parameter id="htmlText" type="string" info="text with HTML tags" />
        		override public function SetData(xmlData:XML):void 
        		   for each (var element:XML in xmlData.children())
        			  if (element.@id == "htmlText") 		
        				  _textField.htmlText =;

The problem is with _textField.htmlText =; line for now. How to reach the textField correctly to use it as a htmlText (not Text as done as default)? Am I on the right direction at all? :slight_smile:


First of all, the line super.SetData(xmlData); will set the TextField’s text property after you set the htmlText property so it should restore it to unformatted text.
Also, the bold tags don’t work apparently. You should set it as:
<font face="Regular Embedded Font Name">Name</font> <font face="Bold Embedded Font Name">Surname</font>
When you embed the fonts, mark the “Export for ActionScript” option, otherwise it won’t work.


Good to know, thanks.