Use CSS to in TextField : StyleSheet « Development « Flash / Flex / ActionScript






Use CSS to in TextField

 

package {

  import flash.display.Sprite;
  import flash.text.TextField;
  public class Main extends Sprite {
    public function Main(  ) {
      var field:TextField = new TextField(  );
    
      var css:flash.text.StyleSheet = new flash.text.StyleSheet(  );
      css.parseCSS("a {color: #0000FF;} a:hover {text-decoration: underline;}");
      field.styleSheet = css;

      field.htmlText = "<a href='http://www.java2s.com'>Website</a>";
      
        addChild(field);
    }
  }
}

        








Related examples in the same category

1.Text formatted with an external style sheet
2.Load a CSS document and use that data to populate a StyleSheet object
3.Formatting text with a programmatically created style sheet
4.Formatting applied to a specific class of paragraph
5.Set the font with CSS