If a specific format (e.g., font, bold, or italic) is not the same for all characters in a specified span, the corresponding variable of the TextFormat object for that span will be null
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, 0, 4);
var allCharsFormat:TextFormat = t.getTextFormat( );
trace(allCharsFormat.bold); // Displays: false
addChild(t);
}
}
}
Related examples in the same category