Text format tag

The <textformat> tag lets you use a subset of paragraph formatting properties of the TextFormat class within HTML text fields, including line leading, indentation, margins, and tab stops. You can combine <textformat> tags with the built-in HTML tags.

The <textformat> tag has the following attributes:

The following table of data with boldfaced row headers is the result of the code example in the procedure that follows:

Name

Age

Occupation

Rick

33

Detective

AJ

34

Detective

To create a formatted table of data using tab stops:

  1. Create a new Flash document, and save it as tabstops.fla.
  2. In the Timeline, select the first frame on Layer 1.
  3. Open the Actions panel (Window > Actions), and enter the following code in the Actions panel:
    // Create a new text field.
    this.createTextField("table_txt", 99, 50, 50, 450, 100);
    table_txt.multiline = true;
    table_txt.html = true;
    // Creates column headers, formatted in bold, separated by tabs.
    var rowHeaders:String = "<b>Name\tAge\tOccupation</b>";
    
    // Creates rows with data.
    var row_1:String = "Rick\t33\tDetective";
    var row_2:String = "AJ\t34\tDetective";
    
    // Sets two tabstops, at 50 and 100 points.
    table_txt.htmlText = "<textformat tabstops='[50,100]'>";
    table_txt.htmlText += rowHeaders;
    table_txt.htmlText += row_1;
    table_txt.htmlText += row_2 ;
    table_txt.htmlText += "</textformat>";
    

    The use of the tab character escape sequence (\t) adds tabs between each column in the table. You append text using the += operator.

  4. Select Control > Test Movie to view the formatted table.

Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00000932.html