Using the StyleSheet with a TextField : StyleSheet : TextField Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » TextField » StyleSheet »

 

Using the StyleSheet with a TextField


 

package{
  import flash.display.Sprite;
  import flash.text.*;
  public class Main extends Sprite{
    public function Main(){

       var txt:TextField = new TextField();
       txt.multiline = true;
       txt.wordWrap = true;
       var cssString:String = ".redStyle{color:#FF0000; font-family:Arial;}.blueStyle{color:#0000FF; font-family:Courier;}";
       var styles:StyleSheet = new StyleSheet();
       styles.parseCSS(cssString);
       txt.styleSheet = styles;
       txt.htmlText = '<span class=" redStyle">This will show up red</span> And this will not. <span class=" blueStyle">This will show up blue</span>';
       addChild(txt);
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo TextField
» StyleSheet