Applying styles for custom TextArea in ActionScript 3
Posted
by Vijay Dev
on Stack Overflow
See other posts from Stack Overflow
or by Vijay Dev
Published on 2010-04-05T15:54:14Z
Indexed on
2010/04/05
17:13 UTC
Read the original article
Hit count: 245
I have the following code to create and apply a few styles for a custom TextArea in ActionScript 3.
public class MyCustomTextArea extends TextArea
{
override protected function createChildren():void
{
super.createChildren();
this.styleSheet.setStyle("sup", { display: "inline", fontFamily: "ArialSup", fontSize:"12"});
this.styleSheet.setStyle("sub", { display: "inline", fontFamily: "ArialSub", fontSize:"12"});
this.setStyle("fontFamily", "Arial");
}
}
I have two problems with this code.
this.styleSheet is always null when I create an instance of the class. If this.styleSheet is initialized to new StyleSheet() to avoid this issue, then the TextArea instance does not seem to recognize any of the HTML tags that can be used with the htmlText property.
Can anyone help in fixing these two issues? Thanks.
© Stack Overflow or respective owner