Mega Code Archive

 
Categories / Flash ActionScript / TextField
 

Formatting Text with HTML

package{   import flash.display.Sprite;   import flash.text.*;     public class Main extends Sprite{     public function Main(){         var t:TextField = new TextField(  );         t.autoSize = TextFieldAutoSize.LEFT;                  var message:String = "<FONT FACE='Arial' SIZE='20'>"                            + "<B>ActionScript is fun!</B></FONT>";                           t.htmlText = message;         //HTML text is assigned directly to the htmlText variable         t.htmlText = "<FONT FACE='Arial' SIZE='20'>"                      + "<B>ActionScript is fun!</B></FONT>";                  addChild(t);     }   } }