ActionScript3:Support for HTML and CSS

From virtualMV2015wiki
Jump to: navigation, search
 Home  Flash11 (CS5) | Flash10 (CS4) <

Formatting Text with HTML and CSS

Icon Objective.png

Objective

By the end of this page you will have:

  • An understanding of the HTML and CSS tags supported by Flash

HTML

Flash supports only a few HTML tags.

HTML Tag Notes
<font> Supported attributes include size, color, face
<b> Bold
<i> Italics
<u> Underlines text
<span> supported attribute: class
<p> paragraph, multiline must be enabled, attributes include align and class
<br> multiline must be enabled
<li> All lists are bulleted (no ul or ol)
<img> Supported attributes are src, height, width, align, hspace, vspace, id
<a> Supported attributes are href, event, target
<textformat> Used to apply a subset of TextFormat properties - block indent, indent, leftmargin, rightmargin.

Further information can be found at Devarticles [1]

To enable HTML in a textfield, change the property from text to htmlText.

Using CSS

Flash also supports a limited number of CSS properties.

CSS Property Notes
color Font color in 0xRRGGBB format
display Display characteristics incl none, block, inline
font-family Font name eg Arial
font-size Size in pixels
font-style Italic or Normal
font-weight Includes bold or normal
kerning Either on or off - true or false
letter-spacing In Pixels
margin-left In Pixels
margin-right In Pixels
text-align left, right, center or justify
text-indent first line indent in pixels
text-decoration Underlines text, either underline or none

See this page for information on creating the stylesheet and using the URLLoader and URLRequest classes.

Icon References.png References

  1. Mora, A. (2005) Working with Text and HTML in Flash, retrieved 5 September 2010 from http://www.devarticles.com/c/a/Flash/Working-with-Text-and-HTML-in-Flash/4/

 

Day, S. (2010). ActionScript3:Support for HTML and CSS. Retrieved January 19, 2018, from http://www.virtualmv.com/wiki/index.php?title=ActionScript3%3ASupport_for_HTML_and_CSS