Using a:link in the CSS sets the link style in flash.
Inserting a paragraph tag with a specific style (one that has no line height) effectively fixes the headings issue.
Haven't figured out bold and italic, but that's not really a major worry. If anyone does, let me know!
Here's the current working code for anyone who's interested:
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.text.TextField;
import flash.events.ProgressEvent;
import fl.text.TLFTextField;
var fonts:Array = Font.enumerateFonts();
for each (var font:Font in fonts)
{
trace( font.fontName+":"+font.fontType );
}
var rss_xml:XML = new XML();
var test_txt:TLFTextField = new TLFTextField ;
with (test_txt)
{
antiAliasType = AntiAliasType.ADVANCED;
width = 940;
height = 600;
x = 0;
y = 0;
autoSize = TextFieldAutoSize.LEFT;
wordWrap = true;
embedFonts = true;
}
var sulsc_style:StyleSheet = new StyleSheet();
var css_loader:URLLoader = new URLLoader();
css_loader.load(new URLRequest("sulsc_style.css"));
css_loader.addEventListener(Event.COMPLETE, onCSSComplete);
function onCSSComplete(e:Event):void
{
sulsc_style.parseCSS(e.target.data);
rss_xml.ignoreWhitespace = false;
var rss_loader:URLLoader = new URLLoader(new URLRequest("http://news.sulsc.org/feed"));
rss_loader.addEventListener(Event.COMPLETE,rss_loaded);
l.mode = "manual";
rss_loader.addEventListener(ProgressEvent.PROGRESS,rss_load);
}
function rss_load(e:ProgressEvent):void
{
//trace(e.bytesLoaded/(113*1024));
l.setProgress(e.bytesLoaded,(113*1024));
}
function rss_loaded(e:Event):void
{
removeChild(l);
l = null;
rss_xml = XML(e.target.data);
rss_xml.ignoreWhiteSpace = true;
var rss_raw:String = String(rss_xml);
rss_raw = rss_raw.split(":encoded").join("");
rss_raw = rss_raw.split("\n").join("");
rss_raw = rss_raw.split('<p style="text-align: right;">').join('<p class="right">');
rss_raw = rss_raw.split('<p style="text-align: center;">').join('<p class="centre">');
rss_raw = rss_raw.split('<p style="text-align: left;">').join('<p class="left">');
rss_raw = rss_raw.split('<p style="text-align: justify;">').join('<p class="just">');
var heading_replace:RegExp = new RegExp("(</h[0-9]>)(<h[0-9]>)","g9");
var underline_replace:RegExp = new RegExp('<span style="text-decoration: underline;">(.*?)</span>',"gi");
var bold_replace:RegExp = new RegExp('<strong>(.*?)</strong>',"gi");
var italic_replace:RegExp = new RegExp('<em>(.*?)</em>',"gi");
rss_raw = rss_raw.replace(heading_replace,'$1<p class="space"></p>$2');
rss_raw = rss_raw.replace(underline_replace,'<u>$1</u>');
rss_raw = rss_raw.replace(bold_replace,'<b>$1</b>');
rss_raw = rss_raw.replace(italic_replace,'<i>$1</i>');
rss_xml = XML(rss_raw);
test_txt.styleSheet = sulsc_style;
test_txt.htmlText = rss_xml.channel.item.(guid == "http://news.sulsc.org/?page_id=400").content;
addChild(test_txt);
}
and the CSS:
/*
flash doesn't support:
-bold and italic
-strikethrough
*/
p, ol, ul, li, body {
font-family: Fontin Sans Rg;
font-size: 12pt;
color: #666666;
text-align: justify;
padding-bottom: 12px;
padding-top: 6px;
}
h1 {
font-family: Nilland;
font-size: 30pt;
text-align:left;
color: #999999;
}
h2 {
font-family: Nilland;
font-size: 20pt;
color: #ff9900;
margin-left:25px;
letter-spacing: 1px;
}
h3 {
font-family: GeosansLight;
font-size: 16pt;
text-align:left;
color: #999999;
margin-left:50px;
letter-spacing: 1px;
}
h4, h5, h6 {
font-family: GeosansLight;
font-size: 14pt;
text-align:left;
color: #999999;
margin-left:75px;
letter-spacing: 1px;
}
ol, ul, li {
margin-left: 50px;
line-height:5px
}
b-quote,blockquote {
font-family: Fontin Sans Rg;
font-style:italic;
color:#999999;
margin-left: 100px;
margin-right: 100px;
padding-bottom: 12px;
}
a:link {
text-decoration: underline;
color: #666666;
}
a:hover {
color: #FF9900;
text-decoration: underline;
}
/* DO NOT DELETE THESE */
.space {
line-height:1px;
padding-bottom: 0px;
padding-top:0px;
}
.right {
text-align:right;
}
.centre {
text-align:center;
}
.left {
text-align:left;
}
.just {
text-align:justify;
}
Which makes:
Thanks for your help!