Flash XML Data formatting
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 i开发者_JS百科tem_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>
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!
精彩评论