User Guide
242 Chapter 9: Working with Text
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.
Underline tag (<u>)
The
<u> tag underlines the tagged text, as shown in the following code:
This is <u>underlined</u> text.
This code would render as follows:
Embedding images, SWF files, and movie clips in text fields
In Flash Player 7 and later, you can use the
<img> tag to embed JPEG files, SWF files, and movie
clips inside dynamic and input text fields, and TextArea component instances. (For a full list of
attributes for the
<img> tag, see “Image tag (<img>)” on page 239.)
Flash displays media embedded in a text field at full size. To specify the dimensions of the media
you are embedding, use the
<img> tags’s height and width attributes. (See “Specifying height
and width values” on page 243.)
In general, an image embedded in a text field appears on the line following the
<img> tag.
However, when the
<img> tag is the first character in the text field, the image appears on the first
line of the text field.
Embedding SWF and JPEG files
To embed a JPEG or SWF file in a text field, specify the absolute or relative path to the JPEG or
SWF file in the
<img> tag’s src attribute. For example, the following code inserts a JPEG file
that’s located in the same directory as the SWF file:
textField_txt.htmlText = "<p>Here’s a picture from my last vacation:<img
src='beach.jpg'>";