Skip to content Skip to sidebar Skip to footer

Flash As3 Xml Cdata Bold Tags Rendered In Htmltext With An Embedded Font

I'm just trying to get flash to render bold text in a dynamic text field with an embedded font, using data I've imported from an xml file using CDATA. Anyone know how to do this? X

Solution 1:

Wrap the text you want to be bold in span tags with a class name.

<description><![CDATA[ FOR THE PAST TWO YEARS, <span class="myBoldText">SUPERFAD</span> HAS WORKED...</description>

Then use a StyleSheet object to style it within your actionScript.

var my_styleSheet = newStyleSheet();
varn:Object = newObject();
n.fontWeight = 'bold';
my_styleSheet.setStyle('.myBoldText', n);
container.header.t_desc.styleSheet = my_styleSheet;
container.header.t_desc.htmlText = project_desc;

Don't forget to import the styleSheet class!

import flash.text.StyleSheet;

More info on the StyleSheet class here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/StyleSheet.html

Post a Comment for "Flash As3 Xml Cdata Bold Tags Rendered In Htmltext With An Embedded Font"