我也提出问题

保留原著,并且问题被回答或审核通过时通知你:


Tag Archives: 样式化

样式化文字的方法。

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

对用户输入的文字进行样式化。

使用defaultTextFormat属性,样式会施加至用户键入输入框的文字身上:
var formatter:TextFormat = new TextFormat();
formatter.color = 0×0000FF; //把文字变成蓝色
field.defaultTextFormat = formatter;
- 作者:SWFAQ | http://swfaq.org

对现有文字的一部分进行样式化。

例如这个方法:
TextFormat.setTextFormat(format:TextFormat, beginIndex:int = -1, endIndex:int = -1):void
- 作者:SWFAQ | http://swfaq.org