HI All,
I want to know how to style an anchor tag(eg: need to chnage color blue and I want to make it bold) in flash.
I created a flash widget that for rss feeds and Im not sure about how to add styles in it like css we using in dreamweaver.
Lets take a look at the script below, it is AS3..
what I want is..
1, I need to make that a tag should be looking bold and paleblue color.
2, Need to add a grey border after description ends.
function onLoaded(e:Event):void
{
xml = new XML(e.target.data);
var il:XMLList = xml.channel.item;
for(var i:uint=0; i<il.length(); i++)
{
ta.htmlText="<a href='"+il.link.text()[0]+"'>"+il.title.text()[0]+"</a>"+"\<br />"+il.description.text()[0]+开发者_JAVA百科"\<br />"+"\<br /><hr />"+"<a href='"+il.link.text()[1]+"'>"+il.title.text()[1]+"</a>"+"\<br />"+il.description.text()[1]+"\<br />"+"\<br /><hr />"+"<a href='"+il.link.text()[2]+"'>"+il.title.text()[2]+"</a>"+"\<br />"+il.description.text()[2];
addChild(ta);
}
}
Looking for your REPLIES ..
Thanks in Advance!
Paul
you can use style sheet in flash textField, but not all properties are supported. only below are supported: color display fontFamily fontSize fontStyle fontWeight kerning leading letterSpacing marginLeft marginRight textAlign textDecoration textIndent see: http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000292.html
You can create a Stylesheet and apply it to your textfield like so:
var css:StyleSheet = new StyleSheet();
css.parseCSS('a { color: #99CCFF; font-weight: bold; }');
textField.styleSheet = css;
Flash only supports a subset of CSS rules for textfields, and this doesn't include borders so you'll probably need to draw your bottom border using the graphics API.
I wrote this a while ago to cover fonts specifically, but it has details in there on using CSS on elements within htmlText. I think it should help you, pay attention to the way the StyleSheet class works: http://mykola.bilokonsky.net/2010/08/flash-css-and-embedded-fonts/
精彩评论