TextFormat.bullet Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
TextFormat.bullet Property Flash 6

specifies whether to add bullets to paragraphs read/write
theFormat.bullet

Description

The Boolean bullet property can create a bulleted list (equivalent to HTML's <UL> tag) from the paragraphs in a text field. When bullet is true, the first line of each formatted paragraph (any span of text ending with a line break character) starts with a small circle icon and is indented. If automatic word-wrapping is enabled for the text field, subsequent lines in the paragraph are also indented, provided that they fall within the range of the format. The circular bullet symbol cannot be customized. Nested bulleted lists are not supported.

To convert an entire text field into a bulleted list, invoke TextField.setTextFormat( ) without specifying any index arguments:

this.createTextField("theField_txt", 1, 0, 0, 200, 60); theField_txt.border = true; theField_txt.text = "Item one.\nItem two.\nItem three." // Create a TextFormat object format = new TextFormat(); format.bullet = true; // Make the whole field bulleted theField_txt.setTextFormat(format);

To add a bullet to the first paragraph in a text field, apply the format to the character at index 0:

theField_txt.setTextFormat(0, format);

To add a bullet to any subsequent paragraphs, apply the format to the character immediately following the newline character:

// Make the second paragraph bulleted theField_txt.setTextFormat(10, format);

To add bullets to a range of paragraphs, apply the format using start and end index arguments that include the desired paragraphs:

// Use bullets with only the second and third paragraphs theField_txt.setTextFormat(10, 21, format);

If any paragraph wraps to the next line, the specified format range must include the subsequent line's first character; otherwise, the format will not apply to the wrapped line.

The default bullet 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 bullet value is null. For a completely new TextFormat object, it is also null, indicating that bullet will not be set when the format is applied to a text field:

trace(anyUnformattedField_txt.getTextFormat().bullet);  // Displays: "false" var format = new TextFormat(); trace(format.bullet);                                   // Displays: "null"

See Also

TextField.wordWrap, TextFormat.blockIndent



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

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