actionscript 3 - flash as3 xml cdata bold tags rendered in htmlText with an embedded font -
i'm trying flash render bold text in dynamic text field embedded font, using data i've imported xml file using cdata. know how this?
xml file:
<description><![cdata[ past 2 years, <b>superfad</b> has worked closely <b>martin agency</b> visualize original works of <b>sport campaign</b>. campaign spotlights extreme athletes of various events artists in own world, using tools of sport create lasting works of art]]></description>
and as3 code:
project_desc = myxml.projects.project[cp].description.touppercase(); container.header.t_desc.htmltext = project_desc;
wrap text want bold in span tags class name.
<description><![cdata[ past 2 years, <span class="myboldtext">superfad</span> has worked...</description>
then use stylesheet object style within actionscript.
var my_stylesheet = new stylesheet(); var n:object = new object(); 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 import stylesheet class!
import flash.text.stylesheet;
more info on stylesheet class here: http://help.adobe.com/en_us/flashplatform/reference/actionscript/3/flash/text/stylesheet.html
Comments
Post a Comment