Home arrow Flash arrow Working with Text and HTML in 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 / 120
May 04, 2005
  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

Working with Text and HTML in Flash
(Page 1 of 6 )

About Text in Flash

There are three types of text in Flash: static, dynamic and input.

Static text is the text whose contents and appearance you determine when you author the Flash document.

Dynamic text fields are the fields whose contents can be updates dynamically at runtime.

Input text fields allow users to enter text into it at runtime.

Just like movie clips and buttons, you can also specify instance names to the dynamic and input text fields to control those using ActionScript. All dynamic and input text fields in a SWF file are instances of the TextField class. So, by specifying the instance name to a text field, you can use the methods and properties of the TextField class to manipulate it with ActionScript. However, unlike with movie clips, you cannot write ActionScript code inside a text instance, because text instances do not have Timelines.

Apart from the TextField class, there is one more class for text -- the TextFormat class. You can use the ActionScript TextFormat class to set the formatting properties of a text field. The TextFormat class incorporates character and paragraph formatting information. Character formatting information describes the appearance of individual characters: font name, point size, color, and an associated URL. Paragraph formatting information describes the appearance of a paragraph: left margin, right margin, indentation of the first line, and left, right, or center alignment.

Using ActionScript you can set, change, and format the text field and its content with the methods and properties of TextField and TextFormat classes. The methods of the TextField class let you set, select, and manipulate text in a dynamic or input text field that you create during authoring or at runtime.

You can also assign HTML formatted text directly to a text field. In Flash Player 7 and later, HTML text that you assign to a text field can contain embedded media such as movie clips, SWF files, and JPEG files. The text wraps around the embedded media in the same way that a Web browser wraps text around media embedded in an HTML document.

blog comments powered by Disqus

- 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

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


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