flash as3 xml cdata 粗体标签在带有嵌入字体的 htmlText 中呈现

发布于 2024-10-17 16:48:07 字数 684 浏览 2 评论 0原文

我只是想让 flash 使用我从使用 CDATA 的 xml 文件导入的数据,在带有嵌入字体的动态文本字段中呈现粗体文本。有人知道该怎么做吗?

XML 文件:

<description><![CDATA[ FOR THE PAST TWO YEARS, <b>SUPERFAD</b> HAS WORKED CLOSELY WITH THE <b>MARTIN AGENCY</b> TO VISUALIZE THE ORIGINAL WORKS OF <b>SPORT CAMPAIGN</b>. THE CAMPAIGN SPOTLIGHTS THE EXTREME ATHLETES OF THE VARIOUS EVENTS AS ARTISTS IN THEIR OWN WORLD, USING THE TOOLS OF THEIR SPORT TO CREATE LASTING WORKS OF ART]]></description>

和 as3 代码:

project_desc = myXML.projects.project[cp].description.toUpperCase();
container.header.t_desc.htmlText = project_desc;

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?

XML File:

<description><![CDATA[ FOR THE PAST TWO YEARS, <b>SUPERFAD</b> HAS WORKED CLOSELY WITH THE <b>MARTIN AGENCY</b> TO VISUALIZE THE ORIGINAL WORKS OF <b>SPORT CAMPAIGN</b>. THE CAMPAIGN SPOTLIGHTS THE EXTREME ATHLETES OF THE VARIOUS EVENTS AS ARTISTS IN THEIR OWN WORLD, USING THE TOOLS OF THEIR SPORT TO CREATE LASTING WORKS OF ART]]></description>

and as3 code:

project_desc = myXML.projects.project[cp].description.toUpperCase();
container.header.t_desc.htmlText = project_desc;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美羊羊 2024-10-24 16:48:07

将要加粗的文本包含在带有类名称的 span 标记中。

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

然后使用 StyleSheet 对象在您的动作脚本中对其进行样式设置。

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;

不要忘记导入 styleSheet 类!

import flash.text.StyleSheet;

有关 StyleSheet 类的更多信息:
http://help.adobe.com/en_US /FlashPlatform/reference/actionscript/3/flash/text/StyleSheet.html

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 = 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 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文