Retrieving formatting information for a span of characters : Text format : TextField Flash / Flex / ActionScript examples


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

 

Retrieving formatting information for a span of characters


 

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

        var t:TextField = new TextField(  );
        t.width = 100;
        t.border = true;
        t.wordWrap = true;
        t.text = "What time is it?";
        
        var arialFormat:TextFormat = new TextFormat(  );
        arialFormat.font = "Arial";
        
        t.setTextFormat(arialFormat, 04);
        
        var firstCharFormat:TextFormat = t.getTextFormat(0);
        
        trace(firstCharFormat.font)// Displays: Arial
        addChild(t);
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo TextField
» Text format