# TextField.setTextFormat()

#### Availability

Flash Player 6.

#### Usage

    my_txt.setTextFormat (textFormat)
    my_txt.setTextFormat (index, textFormat)
    my_txt.setTextFormat (beginIndex, endIndex, textFormat)

#### Parameters

`beginIndex` An integer.

`endIndex` An integer that specifies the first character after the desired text span.

`textFormat` An instance of the TextFormat object. A TextFormat object contains character and paragraph formatting information.

#### Returns

Nothing.

#### Description

Method; sets a TextFormat object for a specified range of text in a text field. You can assign each character in a text field a text format. The text format of the first character of a paragraph is examined to perform paragraph formatting for the entire paragraph. The `setTextFormat` method changes the text format applied to individual characters, to groups of characters, or to the entire body of text in a text field.

The text format is set in a new instance of the TextFormat object. It contains both character and paragraph formatting information. Character formatting information describes the appearance of individual characters, for example, font name, point size, color, and associated URL. Paragraph formatting informationdescribes the appearance of a paragraph, for example, left margin, right margin, indentation of the first line, and left, right, and center alignment.

Usage 1: Applies the properties of `textFormat` to all text in the text field.

Usage 2: Applies the properties of `textFormat` to the character at position `index`.

Usage 3: Applies the properties of the `textFormat` parameter to the span of text from the `beginIndex` parameter to the `endIndex` parameter.

#### Example

This example creates a new TextFormat object called `myTextFormat` and sets its `bold` property to `true`. It then calls the `setTextFormat` method and applies the new text format to the `my_txt` text field.

    myTextFormat = new TextFormat();
    myTextFormat.bold = true;
    my_txt.setTextFormat(myTextFormat);

#### See also

TextFormat object