How do I connect an external stylesheet to a textfield so the htmlText
gets the right styles?
In Flex 1.5 that was easy:
var styles:TextField.StyleSheet = new TextField.StyleSheet();
styles.load('myStyles.css');
...
function onLoad(ok){
if(ok){
myText.htmlText = "hello <a href="somelink.html">world</a>
myText.styleSheet = styles
}
}
But how to do this in Flex 2.0, when function 'load()' doesn't exist
anymore and parseCSS not realy seems tow work with a:hover style etc?
In the 2.0 example I have an Application...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:myText="*" layout="absolute">
<mx:Style source="main.css "/>
<myText:TextFieldExample />
</mx:Application>
...that loads an external stylesheet main.css,...
body {
fontFamily : "ThesisBolPla";
leading : "-3";
}
.heading {
fontWeight :"bold";
color: "#FF3300";
}
a {
color:#f0037f;
}
a:link{
color:#f0037f;
text-decoration:underline;
}
a:hover{
color:#f0037f;
}
a:active{
color:#cccccc;
}
...and creates the an instance of TextFieldExample:
package {
import mx.core.UIComponent;
import flash.text.TextField;
public class TextFieldExample extends UIComponent {
private var label:TextField;
private var labelText:String = "<body><span
class='heading'>Hello world</span><br><a href='javascript:void'>and
welcome</a> to the show. </body>";
public function TextFieldExample() {
configureLabel();
setLabel(labelText);
}
public function setLabel(str:String):void {
label.htmlText = str;
}
private function configureLabel():void {
label = new TextField();
label.width = 200;
label.embedFonts = true;
label.background = true;
label.multiline = true;
label.styleSheet = HOW TO CONNECT TO THE CSS?;
addChild(label);
}
}
}
How do I connect the external stylesheet to the textfield so the
htmlText gets the right style?
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/