Flash
  Home arrow Flash arrow Working with Text and HTML in Flash
IBM developerWorks
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
FLASH

Working with Text and HTML in Flash
By: Adi Reddy Mora
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 82
    2005-05-04

    Table of Contents:
  • Working with Text and HTML in Flash
  • Creating text fields at runtime
  • Using TextFormat Class
  • Formatting Text using HTML
  • Supported HTML tags
  • Embedding media in text fields

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Working with Text and HTML in Flash


    (Page 1 of 6 )

    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.

    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.

    More Flash Articles
    More By Adi Reddy Mora


       · writing html-tags in a textarea field for printing (via database)in a flash-field...
     

    FLASH ARTICLES

    - Using XML and ActionScript with Flex Applica...
    - Interfaces and Events with ActionScript and ...
    - Manipulating Data with ActionScript in Flex ...
    - ActionScript Syntax for Flex Applications
    - ActionScript in Flex Applications
    - A Closer Look at Apollo`s File System API
    - Using the File System API
    - ActionScript 101
    - Flash Buttons
    - Advanced Flash Animation
    - Creating Your First Animated Movie with Flas...
    - Flash: Building Blocks
    - Building Preloaders
    - Fun Things to Do with Movie Clips in Flash MX
    - Referencing Movie Clips in Flash MX


    Iron Speed





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway