Home arrow Flash arrow Page 5 - Working with Text and HTML in Flash
FLASH

Working with Text and HTML in Flash


There are a variety of ways to manipulate text and HTML with Flash that allow you to expand the capabilities of your website. Adi Reddy Mora goes over some of the most common ones.

Author Info:
By: Adi Reddy Mora
Rating: 4 stars4 stars4 stars4 stars4 stars / 107
May 04, 2005
TABLE OF CONTENTS:
  1. · Working with Text and HTML in Flash
  2. · Creating text fields at runtime
  3. · Using TextFormat Class
  4. · Formatting Text using HTML
  5. · Supported HTML tags
  6. · Embedding media in text fields

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Working with Text and HTML in Flash - Supported HTML tags
(Page 5 of 6 )

The following is the list of supported HTML tags in Flash:

Anchor tag (<a>) The <a>tag creates a hypertext link and supports the following attributes: href and target. sample_txt.htmlText= “<a href='http://www.devarticles.com' target='_blank'>Visit Dev Articles</a>”; Bold tag (<b>)

The
<b>tag renders text as bold.
sample_txt.htmlText = “<b>Bold Text</b>”;
 

A bold typeface must be available for the font used to display the text.

Break tag (<br>)

The <br>tag creates a line break in the text field.

sample_txt.htmlText = "First Line of text. <br>Second Line";

The closing </br>tag is optional, but it is good practice to include it.

Font tag (<font>)

The <font>tag specifies a font or list of fonts to display the text and supports the attributes color, face and size.

sample_txt.htmlText = "<font size=’24’ color=’#0000FF’ face=’Arial Black’>This is blue, 24-point text with Arial Black font</font>";

  Image tag (<img>)

The <img>tag lets you embed external JPEG files, SWF files, and movie clips inside text fields and TextArea component instances. Text automatically flows around images you embed in text fields or components. This tag is supported only in dynamic and input text fields that are multiline and wrap their text.

The <img>tags supports the following attributes:

src Specifies the URL to a JPEG or SWF file, or the linkage identifier for a movie clip symbol in the library. This attribute is required; all other attributes are optional. External files (JPEG and SWF files) do not show until they have downloaded completely.

id Specifies the name for the movie clip instance (created by Flash Player) that contains the embedded JPEG file, SWF file, or movie clip. This is useful if you want to control the embedded content with ActionScript.

width The width of the image, SWF file, or movie clip being inserted, in pixels.

height The height of the image, SWF file, or movie clip being inserted, in pixels.

align Specifies the horizontal alignment of the embedded image within the text field. Valid value are leftand right. The default value is left.

hspace Specifies the amount of horizontal space that surrounds the image where no text appears. The default value is 8.

vspace Specifies the amount of vertical space that surrounds the image where no text appears. The default value is 8. 

Italic tag (<i>)

The <i>tag displays the tagged text in italics.

sample_txt.htmlText = “<i>Italic Text</i>”;

An italic typeface must be available for the font used.

List item tag (<li>)

The <li>tag places a bullet in front of the text that it encloses.

<li>One</li>
<li>Two</li>
<li>Three</li>
 

Paragraph tag (<p>)

The <p>tag creates a new paragraph. It supports the following attributes: align and class.

Span tag (<span>)

The <span>tag is available only for use with CSS text styles. It supports the attribute class.

Text format tag (<textformat>)

The <textformat>tag lets you use a subset of paragraph formatting properties of the TextFormat class within HTML text fields. It supports the attributes blockindent, indent, leading, leftmargin, rightmargin and tabstops.

Using the Text tool, create a dynamic text field that’s approximately 300 pixels wide and 100 pixels high.

The use of the tab character escape sequence ( \t) adds tabs between each column in the table.

Underline tag (<u>)

The <u> tag underlines the tagged text.

sample_txt.htmlText = “<u>Underlined Text</u>”;

blog comments powered by Disqus
FLASH ARTICLES

- More Top Flash Game Tutorials
- Top Flash Game Tutorials
- Best Flash Photo Gallery Tutorials
- The Top Flash Tutorials for Menus
- 7 Great Flash Tutorials
- Adobe Creative Suite 5.5 Now Available
- Critical Flash Vulnerability Heats Up the Web
- More on Nonpersistent Client-Side Remote Sha...
- Nonpersistent Client-Side Remote Shared Obje...
- Using the Decorator Pattern for a Real Web S...
- Using Concrete Decorator Classes
- Delving More Deeply into the Decorator Patte...
- The Decorator Pattern in Action
- A Simple Decorator Pattern Example
- Decorator Pattern

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials