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, 0, 4);
var firstCharFormat:TextFormat = t.getTextFormat(0);
trace(firstCharFormat.font); // Displays: Arial
addChild(t);
}
}
}
Related examples in the same category