Different font in same line of text

I may have to create templates that use different types of fonts (example: regular and bold) in the same line of dynamic text (example: first name in regular, last name in bold).

I have to stick with Flash (no time or sufficient experience and knowledge to move to HTML5 at short notice).

The only solution that I can think of, with the knowledge I have, is to split the name in different text objects, one for the first name, one for the last name, etc. Each text object uses the proper font required. I calculate the actual length of the text with AS3 and using this information I move the objects horizontally in order to center them on the graphics (or align them as required).

Any easier solution that you can think of?

Stopped using flash and moved to html years ago, but didn’t textfield support some basic formatting tags including <b>?

		public function wordcolor():void
		{
			
			switch(showcolor)
			{
				case "White" :
			    txtTestFormat2.color = 0xFFFFFF ;
                txtTestFormat1.font = boldfont.fontName;
				txtTestFormat1.size = 34;
			    mcstory.story.setTextFormat(txtTestFormat2 , color_start , color_end );
				break ;
				case "Green" :
			    txtTestFormat2.color = 0xFFFFFF ;
                txtTestFormat1.font = boldfont.fontName;
				txtTestFormat1.size = 34;
			    mcstory.story.setTextFormat(txtTestFormat2 , color_start , color_end );
				break ;
				case "Red" :
			    txtTestFormat2.color = 0x000099 ;
                txtTestFormat1.font = boldfont.fontName;
				txtTestFormat1.size = 34;
			    mcstory.story.setTextFormat(txtTestFormat2 , color_start , color_end );
				break ;
			}

		}

Something similar I do to colorized part of text I think it should also work with different font the same way color_start and color_end is integer that specify in which part of the text to change attributes.
Of cource you must manipulate each text string, I do it form Visual Basic and send the values(color_start , color_end) to AS3 as element

That is exactly how I do that also.

https://drive.google.com/file/d/1D_JhndAopzmhqOyZ3UyCkWDAS11kyD-O/view?usp=sharing

This is a template in which text
antil-alias property has been set to device font
named as xf0
while setting data it should be like "<p>This is <b>some</b> content to <i>test</i>"

as3 file contains following code.

package 
{
	import se.svt.caspar.template.CasparTemplate;
	public class mixweight extends CasparTemplate
	{
		override public function SetData(xmlData:XML):void
		{
			super.SetData(xmlData);
			for each (var element:XML in xmlData.elements())
			{
				
				if (element. @ id == "xf0")
				{
					xf0.htmlText=element.data. @ value;
				}
			}
		}
	}
}

in actionscript you can have a text field in html thus change font, color, style, ecc ecc
like this

var html_temp_storage:String;

html_temp_storage = '<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Sky Text" SIZE="30" COLOR="#FFFFFF" LETTERSPACING="0" KERNING="0">Sky Text  </FONT></P></TEXTFORMAT>';

Clock.xlaps.htmlText = html_temp_storage;

never really used because I switched to html, but I tested few times and worked for me