View comments | RSS feed

Supported CSS properties

Flash Player supports a subset of properties in the original CSS1 specification (www.w3.org/TR/REC-CSS1). The following table shows the supported CSS properties and values as well as their corresponding ActionScript property names. (Each ActionScript property name is derived from the corresponding CSS property name; the hyphen is omitted and the subsequent character is capitalized.)

CSS property

ActionScript property

Usage and supported values

text-align

textAlign

Recognized values are left, center, right, and justify.

font-size

fontSize

Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points are equivalent.

text-decoration

textDecoration

Recognized values are none and underline.

margin-left

marginLeft

Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points are equivalent.

margin-right

marginRight

Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points are equivalent.

font-weight

fontWeight

Recognized values are normal and bold.

kerning

kerning

Recognized values are true and false.

font-style

fontStyle

Recognized values are normal and italic.

letter-spacing

letterSpacing

Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points are equivalent.

text-indent

textIndent

Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points are equivalent.

font-family

fontFamily

A comma-separated list of fonts to use, in descending order of desirability. Any font family name can be used. If you specify a generic font name, it is converted to an appropriate device font. The following font conversions are available: mono is converted to _typewriter, sans-serif is converted to _sans, and serif is converted to _serif.

color

color

Only hexadecimal color values are supported. Named colors (such as blue) are not supported. Colors are written in the following format: #FF0000.

display

display

Supported values are inline, block, and none.

For an example of using styles on XML elements, see An example of using styles with XML.


Flash CS3


Comments


Murejib said on Feb 15, 2008 at 9:03 AM :
Why there is no "leading" property supported by TextFormat class?
First, I thought it is not supported by flash css-parser, but a simple test shows it works. (flash player 8 and higher)

var overall_style_str:String = "h1 {font-family: _sans; color:#FF0000; font-size: 15; font-weight: bold; display: block; leading: 40;}";
var css_style:TextField.StyleSheet = new TextField.StyleSheet();
css_style.parseCSS(overall_style_str);
var test:TextField = this.createTextField("test",0,0,0,300,300);
test.multiline = true;
test.html = true;
test.wordWrap = true;
test.styleSheet = css_style;
test.htmlText="<h1>Header Header Header Header Header Header Header Header</h1>";

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00000908.html