Mega Code Archive

 
Categories / Flash ActionScript / TextField
 

Set text format by searching the substring in textfield

package{   import flash.display.Sprite;   import flash.text.*;   public class Main extends Sprite{     public function Main(){         var t:TextField = new TextField(  );         t.width = 400;         t.text = "This is bold text.";         var regularFormat:TextFormat = new TextFormat(  );         regularFormat.bold = false;         t.setTextFormat(regularFormat,                         t.text.indexOf("This isn't bold."),                         t.length);                  addChild(t);     }   } }