1. 使用HTML标签进行样式化;
2. 使用TextFormat对象;
3. 使用CSS.
例如:HTML是用标签,TextFormat对象是设定font属性,而CSS是使用font-family属性的.
受支持的层叠样式表(CSS)属性和值,及其相应的ActionScript属性名称(小括号内):
color(color),display(display),font-family(fontFamily),font-size(fontSize),font-style(fontStyle),font-weight(fontWeight),kerning(kerning),leading(leading),letter-spacing(letterSpacing),margin-left(marginLeft),margin-right(marginRight),text-align(textAlign),text-decoration(textDecoration),text-indent(textIndent)
受支持的HTML实体: (大于号: >), &(和: &), “(双引号: “), ‘(撇号,单引号: ‘)
其中样式对象的两种写法:
写法一:
var sampleStyle:Object = new Object();
sampleStyle.color = “#FFFFFF”;
sampleStyle.textAlign = “center”;
css.setStyle(“.sample”, sampleStyle);
写法二:
var sampleStyle:Object = {color: “#FFFFFF”, textAlign: “center”};
css.setStyle(“.sample”, sampleStyle);
- 作者:SWFAQ | http://swfaq.org
-
关键字