TextAttrs object

 < Day Day Up > 

Availability

Flash MX 2004.

Description

The TextAttrs object contains all the properties of text that can be applied to a subselection. This object is a property of the TextRun object (textrun.textAttrs).

Property summary for the TextAttrs object

The following properties are available for the TextAttrs object.

Property

Description

textAttrs.aliasText

A Boolean value that specifies that Flash should draw the text using a method optimized for increasing the legibility of small text.

textAttrs.alignment

A string that specifies paragraph justification. Acceptable values are "left", "center", "right", and "justify".

textAttrs.autoKern

A Boolean value that determines whether Flash uses (TRue) or ignores (false) pair kerning information in the font(s) to kern the text.

textAttrs.bold

A Boolean value. A value of true causes text to appear with the bold version of the font.

textAttrs.characterPosition

A string that determines the baseline for the text.

textAttrs.characterSpacing

Deprecated in favor of textAttrs.letterSpacing. An integer that represents the space between characters.

textAttrs.face

A string that represents the name of the font, such as "Arial".

textAttrs.fillColor

A string, hexadecimal value, or integer that represents the fill color.

textAttrs.indent

An integer that specifies paragraph indentation.

textAttrs.italic

A Boolean value. A value of true causes text to appear with the italic version of the font.

textAttrs.leftMargin

An integer that specifies the paragraph's left margin.

textAttrs.letterSpacing

An integer that represents the space between characters.

textAttrs.lineSpacing

An integer that specifies the line spacing (leading) of the paragraph

textAttrs.rightMargin

An integer that specifies the paragraph's right margin.

textAttrs.rotation

A Boolean value. A value of true causes Flash to rotate the characters of the text 90°. The default value is false.

textAttrs.size

An integer that specifies the size of the font.

textAttrs.target

A string that represents the target property of the text field.

textAttrs.url

A string that represents the URL property of the text field.


textAttrs.aliasText

Availability

Flash MX 2004.

Usage

textAttrs.aliasText

Description

Property; a Boolean value that specifies that Flash should draw the text using a method optimized for increasing the legibility of small text.

Example

The following example sets the aliasText property to true for all the text in the currently selected text field:

fl.getDocumentDOM().setElementTextAttr('aliasText', true);

textAttrs.alignment

Availability

Flash MX 2004.

Usage

textAttrs.alignment

Description

Property; a string that specifies paragraph justification. Acceptable values are "left", "center", "right", and "justify".

Example

The following example sets the paragraphs that contain characters between index 0 up to, but not including, index 3 to justify. This can affect characters outside the specified range if they are in the same paragraph.

fl.getDocumentDOM().setTextSelection(0, 3); fl.getDocumentDOM().setElementTextAttr('alignment', 'justify');

textAttrs.autoKern

Availability

Flash MX 2004.

Usage

textAttrs.autoKern

Description

Property; a Boolean value that determines whether Flash uses (TRue) or ignores (false) pair kerning information in the font(s) when it kerns the text.

Example

The following example selects the characters from index 2 up to, but not including, index 6 and sets the autoKern property to true:

fl.getDocumentDOM().setTextSelection(3, 6); fl.getDocumentDOM().setElementTextAttr('autoKern', true);

textAttrs.bold

Availability

Flash MX 2004.

Usage

textAttrs.bold

Description

Property; a Boolean value. A value of TRue causes text to appear with the bold version of the font.

Example

The following example selects the first character of the selected text object and sets the bold property to TRue:

fl.getDocumentDOM().setTextSelection(0, 1); fl.getDocumentDOM().setElementTextAttr('bold', true);

textAttrs.characterPosition

Availability

Flash MX 2004.

Usage

textAttrs.characterPosition

Description

Property; a string that determines the baseline for the text. Acceptable values are "normal", "subscript", and "superscript". This property applies only to static text.

Example

The following example selects the characters from index 2 up to, but not including, index 6 of the selected text field and sets the characterPosition property to "subscript":

fl.getDocumentDOM().setTextSelection(2, 6); fl.getDocumentDOM().setElementTextAttr("characterPosition", "subscript");

textAttrs.characterSpacing

Availability

Flash MX 2004. Deprecated in Flash 8 in favor of textAttrs.letterSpacing.

Usage

textAttrs.characterSpacing

Description

Property; an integer that represents the space between characters. Acceptable values are -60 through 60.

This property applies only to static text; it generates a warning if used with other text types.

Example

The following example sets the character spacing of the selected text field to 10:

fl.getDocumentDOM().setElementTextAttr("characterSpacing", 10);

textAttrs.face

Availability

Flash MX 2004.

Usage

textAttrs.face

Description

Property; a string that represents the name of the font, such as "Arial".

Example

The following example sets the font of the selected text field from the character at index 2 up to, but not including, the character at index 8 to "Arial":

fl.getDocumentDOM().selection[0].setTextAttr("face", "Arial", 2, 8);

textAttrs.fillColor

Availability

Flash MX 2004.

Usage

textAttrs.fillColor

Description

Property; the color of the fill, in one of the following formats:

  • a string in the format "#RRGGBB" or "#RRGGBBAA"

  • a hexadecimal number in the format 0xRRGGBB

  • an integer that represents the decimal equivalent of a hexadecimal number

Example

The following example sets the color of the selected text field from the character at index 2 up to, but not including, the character at index 8 to red:

fl.getDocumentDOM().selection[0].setTextAttr("fillColor", 0xff0000, 2, 8);

textAttrs.indent

Availability

Flash MX 2004.

Usage

textAttrs.indent

Description

Property; an integer that specifies paragraph indentation. Acceptable values are -720 through 720.

Example

The following example sets the indentation of the selected text field from the character at index 2 up to, but not including, the character at index 8 to 100. This can affect characters outside the specified range if they are in the same paragraph.

fl.getDocumentDOM().selection[0].setTextAttr("indent", 100, 2, 8);

textAttrs.italic

Availability

Flash MX 2004.

Usage

textAttrs.italic

Description

Property; a Boolean value. A value of true causes text to appear with the italic version of the font.

Example

The following example sets the selected text field to italic:

fl.getDocumentDOM().selection[0].setTextAttr("italic", true);

textAttrs.leftMargin

Availability

Flash MX 2004.

Usage

textAttrs.leftMargin

Description

Property; an integer that specifies the paragraph's left margin. Acceptable values are 0 through 720.

Example

The following example sets the leftMargin property of the selected text field from the character at index 2 up to, but not including, the character at index 8 to 100. This can affect characters outside the specified range if they are in the same paragraph.

fl.getDocumentDOM().selection[0].setTextAttr("leftMargin", 100, 2, 8);

textAttrs.letterSpacing

Availability

Flash 8.

Usage

textAttrs.letterSpacing

Description

Property; an integer that represents the space between characters. Acceptable values are -60 through 60.

This property applies only to static text; it generates a warning if used with other text types.

Example

The following code selects the characters from index 0 up to but not including index 10 and sets the character spacing to 60:

fl.getDocumentDOM().setTextSelection(0, 10); fl.getDocumentDOM().setElementTextAttr("letterSpacing", 60);

textAttrs.lineSpacing

Availability

Flash MX 2004.

Usage

textAttrs.lineSpacing

Description

Property; an integer that specifies the line spacing (leading) of the paragraph. Acceptable values are -360 through 720.

Example

The following example sets the selected text field's lineSpacing property to 100:

fl.getDocumentDOM().selection[0].setTextAttr("lineSpacing", 100);

textAttrs.rightMargin

Availability

Flash MX 2004.

Usage

textAttrs.rightMargin

Description

Property; an integer that specifies the paragraph's right margin. Acceptable values are 0 through 720.

Example

The following example sets the rightMargin property of the selected text field from the character at index 2 up to, but not including, the character at index 8 to 100. This can affect characters outside the specified range if they are in the same paragraph.

fl.getDocumentDOM().selection[0].setTextAttr("rightMargin", 100, 2, 8);

textAttrs.rotation

Availability

Flash MX 2004.

Usage

textAttrs.rotation

Description

Property; a Boolean value. A value of TRue causes Flash to rotate the characters of the text 90°. The default value is false. This property applies only to static text with a vertical orientation; it generates a warning if used with other text types.

Example

The following example sets the rotation of the selected text field to TRue:

fl.getDocumentDOM().setElementTextAttr("rotation", true);

textAttrs.size

Availability

Flash MX 2004.

Usage

textAttrs.size

Description

Property; an integer that specifies the size of the font.

Example

The following example retrieves the size of the character at index 2 and shows the result in the Output panel:

fl.outputPanel.trace(fl.getDocumentDOM().selection[0].getTextAttr("size",   2));

textAttrs.target

Availability

Flash MX 2004.

Usage

textAttrs.target

Description

Property; a string that represents the target property of the text field. This property works only with static text.

Example

The following example gets the target property of the text field in the first frame of the top layer of the current scene and shows it in the Output panel:

fl.outputPanel.trace(fl.getDocumentDOM().getTimeline().layers[0].frames[0].   elements[0].getTextAttr("target"));

textAttrs.url

Availability

Flash MX 2004.

Usage

textAttrs.url

Description

Property; a string that represents the URL property of the text field. This property works only with static text.

Example

The following example sets the URL of the selected text field to http://www.macromedia.com:

fl.getDocumentDOM().setElementTextAttr("url", "http://www.macromedia.com");

     < Day Day Up > 


    Developing Extensions for Macromedia Flash 8
    Developing Extensions for Macromedia Flash 8
    ISBN: 032139416X
    EAN: 2147483647
    Year: 2005
    Pages: 81

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net