Home arrow Flash arrow Page 6 - 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 / 108
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 - Embedding media in text fields
(Page 6 of 6 )

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.

To embed a JPEG or SWF file in a text field you need to specify the absolute or relative path to the JPEG or SWF file in the <img>tag’s srcattribute.

Example:

sample_txt.htmlText = "<p>Picture:<img src='pic.jpg'>";

To embed a movie clip symbol in a text field, you specify the symbol’s linkage identifier for the <img>tag’s srcattribute.

Example:

sample_txt.htmlText = "<p>Movie clip:<img src='symbol_ID'>";

You can control the embedded media using ActionScript by specifying the id attribute in the <img> tag.

Flash Player creates a new movie clip for each <img>tag and embeds that movie clip within the TextField object. The movie clip created by Flash Player is added as a child movie clip to the text field that contains the image.

Example:

_root.sample_txt.htmlText =
"SWF: <img src='animation.swf' id='animation_mc'>";
The path of the embedded SWF will be
_level0.
sample_txt .animation_mc.
_level0.textField_txt.animation_mc.stop(); stops the SWF file.
 

 


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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 3 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials