Flash XML 数据格式化

发布于 2024-09-18 11:09:54 字数 499 浏览 2 评论 0原文

是否可以格式化在 Flash 中显示的 xml 文件中的文本。下面是我的 xml 文件,带有 3 个菜单标签。当“New”一词显示在 Flash 文件中时,是否可以仅突出显示并斜体显示“New”一词。我尝试做类似 New 的事情,但它不起作用..

<?xml version="1.0" encoding="utf-8"?>
<items>
 <item item_label="Home" item_url="index.html" item_url_target="_self"/>
 <item item_label="New Travel Dates" item_url="travel.html" item_url_target="_self"/>
 <item item_label="New Itinerary" item_url="itinerary.html" item_url_target="_self"/></items>

Is it possible to format text in xml file that gets displayed in flash. Below is my xml file with 3 menu labels. Is it possible to just highlight and italicize the word 'New' when it displays in a flash file. I tried doing something like New, but it wont work..

<?xml version="1.0" encoding="utf-8"?>
<items>
 <item item_label="Home" item_url="index.html" item_url_target="_self"/>
 <item item_label="New Travel Dates" item_url="travel.html" item_url_target="_self"/>
 <item item_label="New Itinerary" item_url="itinerary.html" item_url_target="_self"/></items>

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

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

发布评论

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

评论(1

蓝眸 2024-09-25 11:09:54

好吧,您可以在字符串中搜索短语“new”并在加载到 Flash 后对其进行更改,或者您可以将 html 字符串传递给它并使用 !CDATA 标签使用 css 格式:

 <item item_label="Home" item_url="index.html" item_url_target="_self"><![CDATA[<span class="italic">New</span> Itinerary]]></item>

然后使用文本字段的 htmlText 属性,然后使用样式表:

textField.htmlText = stringFromXML;
var style:StyleSheet = new StyleSheet();
style.setStyle("#italic", {font-style:'italic'});
textfield.styleSheet = style;

确保您也嵌入了斜体字体!

well you can either search the string for the phrase "new" and change it after it is loaded into flash, or you can pass html strings to it and use css formating by using !CDATA tags:

 <item item_label="Home" item_url="index.html" item_url_target="_self"><![CDATA[<span class="italic">New</span> Itinerary]]></item>

then use the htmlText attribute of a textfield, and then use a stylesheet:

textField.htmlText = stringFromXML;
var style:StyleSheet = new StyleSheet();
style.setStyle("#italic", {font-style:'italic'});
textfield.styleSheet = style;

make sure you have the italic font embedded too!

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