Set text format by searching the substring in textfield : Text format : TextField Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » TextField » Text format »

 

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);
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo TextField
» Text format