TextFormat.italic Property | Flash 6 |
Boolean; specifies italicized character display | read/write |
The Boolean italic property specifies whether characters are displayed in an italic typeface (true) or a regular (nonitalic) typeface (false).
To set italics for an entire text field, invoke TextField.setTextFormat( ) without specifying any index arguments:
this.createTextField("theField_txt", 1, 0, 0, 200, 20); theField_txt.border = true; theField_txt.text = "What a nice hat!" // Create a TextFormat object format = new TextFormat(); format.italic = true; // Italicize the whole field theField_txt.setTextFormat(format);
To set italics for a single character, apply the format with a single index argument:
theField_txt.setTextFormat(5, format); // Italicize the sixth character ("a").
To set italics for a range of characters, apply the format with start and end index arguments:
theField_txt.setTextFormat(7, 11, format); // Italicize the characters at // indexes 7, 8, 9 and 10 ("nice")
The default italic value (as contained in the TextFormat object returned by TextField.getTextFormat( )) for a text field that contains text is false. For a text field without any text, the italic value is null. For a completely new TextFormat object, it is also null, indicating that italic will not be set when the format is applied to a text field:
trace(anyUnformattedField_txt.getTextFormat().italic); // Displays: "false" var format = new TextFormat(); trace(format.italic); // Displays: "null"