Text format tag

플래시의 텍스트 필드는 table 태그를 지원하지 않으므로 아래의 방법을 이용하여 표를 이용한 것과 같은 레이아웃을 작성할 수 있다.

Text format tag ()

The 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 tags with the built-in HTML tags.

The <> tag has the following attributes:

* blockindent Specifies the block indentation in points; corresponds to TextFormat.blockIndent. (See TextFormat.blockIndent in Flash ActionScript Language Reference.)
* indent Specifies the indentation from the left margin to the first character in the paragraph; corresponds to TextFormat.indent. (See TextFormat.indent in Flash ActionScript Language Reference.)
* leading Specifies the amount of leading (vertical space) between lines; corresponds to TextFormat.leading. (See TextFormat.leading in Flash ActionScript Language Reference.)
* leftmargin Specifies the left margin of the paragraph, in points; corresponds to TextFormat.leftMargin. (See TextFormat.leftMargin in Flash ActionScript Language Reference.)
* rightmargin Specifies the right margin of the paragraph, in points; corresponds to TextFormat.rightMargin. (See TextFormat.rightMargin in Flash ActionScript Language Reference.)
* tabstops Specifies custom tab stops as an array of non-negative integers; corresponds to TextFormat.tabStops. (See TextFormat.tabStops in Flash ActionScript Language Reference.)

The following code example uses the tabstops attribute of the tag to create a table of data with boldfaced row headers:

Name Age Department
Tim 32 finance
Edwin 46 marketing

To create a formatted table of data using tab stops:

1. Using the Text tool, create a dynamic text field that’s approximately 300 pixels wide and 100 pixels high.
2. In the Property inspector, name the instance table_txt, select Multiline from the Line Type pop-up menu, and select the Render Text as HTML option.
3. In the Timeline, select the first frame on Layer 1.
4. Open the Actions panel (Window > Development Panels > Actions), and enter the following code in the Actions panel:

//Creates column headers, formatted in bold, separated by tabs
var rowHeaders = "<b>Name\tAge\tDepartment</b>";

//Creates rows with data
var row_1 = "Tim\t32\tFinance";
var row_2 = "Edwin\t46\tMarketing";

//Sets two tabstops, to 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.
5. Select Control > Test Movie to view the formatted table.

*주의
1. 반드시 textfield의 htmlText 속성을 true로 바꿀 것.
2. Multiline 속성을 반드시 켜줄 것.


Macromdia livedocs 원문